mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
Merge pull request #457 from hochhaus/quote_properties
Quote properties on window in tests
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user