-
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.
Fix: display error when previewing flash and not enabled (#733)
- Loading branch information
1 parent
8039f1d
commit 794a053
Showing
4 changed files
with
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import SWFLoader from '../SWFLoader'; | ||
import AssetLoader from '../../AssetLoader'; | ||
import Browser from '../../../Browser'; | ||
import PreviewError from '../../../PreviewError'; | ||
|
||
const sandbox = sinon.sandbox.create(); | ||
|
||
describe('lib/viewers/SWFLoader', () => { | ||
afterEach(() => { | ||
sandbox.verifyAndRestore(); | ||
}); | ||
|
||
describe('determineViewer()', () => { | ||
it('should throw a preview error if flash is not supported', () => { | ||
sandbox.stub(Browser, 'hasFlash').returns(false); | ||
expect(() => SWFLoader.determineViewer()).to.throw(PreviewError); | ||
}); | ||
|
||
it('should call the superclass determineViewer if flash is suported', () => { | ||
sandbox.stub(Browser, 'hasFlash').returns(true); | ||
const stub = sandbox.stub(AssetLoader.prototype, 'determineViewer'); | ||
SWFLoader.determineViewer(); | ||
expect(stub).to.have.been.called; // eslint-disable-line no-unused-expressions | ||
}); | ||
}); | ||
}); |