[Common UI] Fix FullscreenActionSpec
Fix FullscreenActionSpec such that it will execute on command line; the global screenfull dependency behaves differently during attempts to spy on methods from the command line build, so replace it entirely. Concludes work on WTD-574 in preparation to submit for review.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,afterEach,screenfull*/
|
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,afterEach,window*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
||||||
@@ -10,25 +10,26 @@ define(
|
|||||||
|
|
||||||
describe("The fullscreen action", function () {
|
describe("The fullscreen action", function () {
|
||||||
var action,
|
var action,
|
||||||
oldToggle;
|
oldScreenfull;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
// Screenfull is not shimmed or injected, so
|
// Screenfull is not shimmed or injected, so
|
||||||
// we need to spy on it in the global scope.
|
// we need to spy on it in the global scope.
|
||||||
oldToggle = screenfull.toggle;
|
oldScreenfull = window.screenfull;
|
||||||
|
|
||||||
screenfull.toggle = jasmine.createSpy("toggle");
|
window.screenfull = {};
|
||||||
|
window.screenfull.toggle = jasmine.createSpy("toggle");
|
||||||
|
|
||||||
action = new FullscreenAction({});
|
action = new FullscreenAction({});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
screenfull.toggle = oldToggle;
|
window.screenfull = oldScreenfull;
|
||||||
});
|
});
|
||||||
|
|
||||||
it("toggles fullscreen mode when performed", function () {
|
it("toggles fullscreen mode when performed", function () {
|
||||||
action.perform();
|
action.perform();
|
||||||
expect(screenfull.toggle).toHaveBeenCalled();
|
expect(window.screenfull.toggle).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("provides displayable metadata", function () {
|
it("provides displayable metadata", function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user