Skip to content

Commit 9ea1924

Browse files
committed
fix(youtube-player): YT.Player is not a constructor test
added a test to prevent reggression, the test mimicks a possible state of the YT object when loading, when window.YT exists but window.YT.Player does not. Fixes #20598
1 parent 06c2784 commit 9ea1924

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/youtube-player/youtube-player.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {createFakeYtNamespace} from './fake-youtube-player';
66
import {Subscription} from 'rxjs';
77

88
const VIDEO_ID = 'a12345';
9+
const YT_LOADING_STATE_MOCK = {loading: 1, loaded: 0};
910

1011
describe('YoutubePlayer', () => {
1112
let playerCtorSpy: jasmine.Spy;
@@ -381,6 +382,8 @@ describe('YoutubePlayer', () => {
381382
});
382383

383384
it('waits until the api is ready before initializing', () => {
385+
(window.YT as any) = YT_LOADING_STATE_MOCK;
386+
384387
fixture = TestBed.createComponent(TestApp);
385388
testComponent = fixture.debugElement.componentInstance;
386389
fixture.detectChanges();

0 commit comments

Comments
 (0)