@@ -15,6 +15,7 @@ import {
1515 YouTubePlayer ,
1616} from './youtube-player' ;
1717import { PlaceholderImageQuality } from './youtube-player-placeholder' ;
18+ import type * as YT from 'youtube' ;
1819
1920declare var window : Window ;
2021
@@ -200,7 +201,7 @@ describe('YoutubePlayer', () => {
200201 fixture . detectChanges ( ) ;
201202 events . onReady ( { target : playerSpy } ) ;
202203
203- const playerVars : YT . PlayerVars = { modestbranding : YT . ModestBranding . Modest } ;
204+ const playerVars : YT . PlayerVars = { modestbranding : ( window as any ) . YT . ModestBranding . Modest } ;
204205 fixture . componentInstance . playerVars = playerVars ;
205206 fixture . changeDetectorRef . markForCheck ( ) ;
206207 fixture . detectChanges ( ) ;
@@ -389,7 +390,9 @@ describe('YoutubePlayer', () => {
389390 fixture . detectChanges ( ) ;
390391
391392 testComponent . youtubePlayer . playVideo ( ) ;
392- expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe ( YT . PlayerState . PLAYING ) ;
393+ expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe (
394+ ( window as any ) . YT . PlayerState . PLAYING ,
395+ ) ;
393396
394397 events . onReady ( { target : playerSpy } ) ;
395398
@@ -401,7 +404,9 @@ describe('YoutubePlayer', () => {
401404 fixture . detectChanges ( ) ;
402405
403406 testComponent . youtubePlayer . pauseVideo ( ) ;
404- expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe ( YT . PlayerState . PAUSED ) ;
407+ expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe (
408+ ( window as any ) . YT . PlayerState . PAUSED ,
409+ ) ;
405410
406411 events . onReady ( { target : playerSpy } ) ;
407412
@@ -413,7 +418,9 @@ describe('YoutubePlayer', () => {
413418 fixture . detectChanges ( ) ;
414419
415420 testComponent . youtubePlayer . stopVideo ( ) ;
416- expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe ( YT . PlayerState . CUED ) ;
421+ expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe (
422+ ( window as any ) . YT . PlayerState . CUED ,
423+ ) ;
417424
418425 events . onReady ( { target : playerSpy } ) ;
419426
0 commit comments