-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: Render Vera-protected HTML files (#220)
Render Vera-protected files instead of displaying the raw HTML.
- Loading branch information
Showing
5 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* eslint-disable no-unused-expressions */ | ||
import TextLoader from '../TextLoader'; | ||
import * as util from '../../../util'; | ||
|
||
let file; | ||
const sandbox = sinon.sandbox.create(); | ||
|
||
describe('lib/viewers/text/TextLoader', () => { | ||
beforeEach(() => { | ||
TextLoader.viewers = [ | ||
{ | ||
REP: 'ORIGINAL', | ||
EXT: 'html' | ||
} | ||
]; | ||
|
||
file = { | ||
extension: 'html', | ||
representations: { | ||
entries: [ | ||
{ | ||
representation: 'ORIGINAL' | ||
} | ||
] | ||
} | ||
}; | ||
}); | ||
|
||
afterEach(() => { | ||
sandbox.verifyAndRestore(); | ||
}); | ||
|
||
describe('determineViewer()', () => { | ||
it('should return viewer if file is not a Vera-protected file', () => { | ||
sandbox.stub(util, 'isVeraProtectedFile').returns(false); | ||
expect(TextLoader.determineViewer(file)).to.equal(TextLoader.viewers[0]); | ||
}); | ||
|
||
it('should return undefined if file is a Vera-protected file', () => { | ||
sandbox.stub(util, 'isVeraProtectedFile').returns(true); | ||
expect(TextLoader.determineViewer(file)).to.equal(undefined); | ||
}); | ||
}); | ||
}); |