@@ -10,8 +10,10 @@ import {
1010} from './youtube-player' ;
1111import { PlaceholderImageQuality } from './youtube-player-placeholder' ;
1212
13+ declare var window : Window ;
14+
1315const VIDEO_ID = 'a12345' ;
14- const YT_LOADING_STATE_MOCK = { loading : 1 , loaded : 0 } ;
16+ const YT_LOADING_STATE_MOCK = { loading : 1 , loaded : 0 } as unknown as typeof YT ;
1517const TEST_PROVIDERS : ( Provider | EnvironmentProviders ) [ ] = [
1618 {
1719 provide : YOUTUBE_PLAYER_CONFIG ,
@@ -56,7 +58,7 @@ describe('YoutubePlayer', () => {
5658 } ) ;
5759
5860 afterEach ( ( ) => {
59- ( window as any ) . YT = undefined ;
61+ window . YT = undefined ;
6062 window . onYouTubeIframeAPIReady = undefined ;
6163 } ) ;
6264
@@ -540,17 +542,17 @@ describe('YoutubePlayer', () => {
540542 let api : typeof YT ;
541543
542544 beforeEach ( ( ) => {
543- api = window . YT ;
544- ( window as any ) . YT = undefined ;
545+ api = window . YT ! ;
546+ window . YT = undefined ;
545547 } ) ;
546548
547549 afterEach ( ( ) => {
548- ( window as any ) . YT = undefined ;
550+ window . YT = undefined ;
549551 window . onYouTubeIframeAPIReady = undefined ;
550552 } ) ;
551553
552554 it ( 'waits until the api is ready before initializing' , ( ) => {
553- ( window . YT as any ) = YT_LOADING_STATE_MOCK ;
555+ window . YT = YT_LOADING_STATE_MOCK ;
554556 TestBed . configureTestingModule ( { providers : TEST_PROVIDERS } ) ;
555557 fixture = TestBed . createComponent ( TestApp ) ;
556558 testComponent = fixture . debugElement . componentInstance ;
@@ -560,7 +562,7 @@ describe('YoutubePlayer', () => {
560562
561563 expect ( playerCtorSpy ) . not . toHaveBeenCalled ( ) ;
562564
563- window . YT = api ! ;
565+ window . YT = api ;
564566 window . onYouTubeIframeAPIReady ! ( ) ;
565567
566568 expect ( playerCtorSpy ) . toHaveBeenCalledWith (
@@ -585,7 +587,7 @@ describe('YoutubePlayer', () => {
585587
586588 expect ( playerCtorSpy ) . not . toHaveBeenCalled ( ) ;
587589
588- window . YT = api ! ;
590+ window . YT = api ;
589591 window . onYouTubeIframeAPIReady ! ( ) ;
590592
591593 expect ( spy ) . toHaveBeenCalled ( ) ;
@@ -601,7 +603,7 @@ describe('YoutubePlayer', () => {
601603 } ) ;
602604
603605 afterEach ( ( ) => {
604- fixture = testComponent = ( window as any ) . YT = window . onYouTubeIframeAPIReady = undefined ! ;
606+ fixture = testComponent = window . YT = window . onYouTubeIframeAPIReady = undefined ! ;
605607 } ) ;
606608
607609 it ( 'should show a placeholder' , ( ) => {
0 commit comments