Merge pull request #457 from hochhaus/quote_properties

Quote properties on window in tests
This commit is contained in:
Joey Parrish
2016-07-24 11:21:15 -07:00
committed by GitHub
2 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -58,7 +58,7 @@ describe('CastReceiver', function() {
// Don't do any more work here if the tests will not end up running.
if (!isChromecast && !isChrome) return;
originalCast = window.cast;
originalCast = window['cast'];
originalUserAgent = navigator.userAgent;
// In uncompiled mode, there is a UA check for Chromecast in order to make
@@ -72,7 +72,7 @@ describe('CastReceiver', function() {
afterAll(function() {
if (originalUserAgent) {
window.cast = originalCast;
window['cast'] = originalCast;
Object.defineProperty(window['navigator'],
'userAgent', {value: originalUserAgent});
}
@@ -80,7 +80,7 @@ describe('CastReceiver', function() {
beforeEach(function() {
mockReceiverApi = createMockReceiverApi();
window.cast = { receiver: mockReceiverApi };
window['cast'] = { receiver: mockReceiverApi };
mockReceiverManager = createMockReceiverManager();
mockMessageBus = createMockMessageBus();
+5 -5
View File
@@ -43,11 +43,11 @@ describe('CastSender', function() {
CastSender = shaka.cast.CastSender;
CastUtils = shaka.cast.CastUtils;
originalChrome = window.chrome;
originalChrome = window['chrome'];
});
afterAll(function() {
window.chrome = originalChrome;
window['chrome'] = originalChrome;
});
beforeEach(function() {
@@ -56,7 +56,7 @@ describe('CastSender', function() {
onResumeLocal = jasmine.createSpy('onResumeLocal');
mockCastApi = createMockCastApi();
window.chrome = { cast: mockCastApi };
window['chrome'] = { cast: mockCastApi };
mockSession = null;
sender = new CastSender(fakeAppId, onStatusChanged, onRemoteEvent,
@@ -71,7 +71,7 @@ describe('CastSender', function() {
describe('init', function() {
it('installs a callback if the cast API is not available', function() {
// Remove the mock cast API.
delete window.chrome.cast;
delete window['chrome'].cast;
// This shouldn't exist yet.
expect(window.__onGCastApiAvailable).toBe(undefined);
@@ -82,7 +82,7 @@ describe('CastSender', function() {
expect(onStatusChanged).not.toHaveBeenCalled();
// Restore the mock cast API.
window.chrome.cast = mockCastApi;
window['chrome'].cast = mockCastApi;
window.__onGCastApiAvailable(true);
// Expect the API to be ready and initialized.
expect(sender.apiReady()).toBe(true);