@@ -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,9 @@ 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 = {
205+ modestbranding : ( window as Window & { YT ?: typeof YT } ) . YT ! . ModestBranding . Modest ,
206+ } ;
204207 fixture . componentInstance . playerVars = playerVars ;
205208 fixture . changeDetectorRef . markForCheck ( ) ;
206209 fixture . detectChanges ( ) ;
@@ -389,7 +392,9 @@ describe('YoutubePlayer', () => {
389392 fixture . detectChanges ( ) ;
390393
391394 testComponent . youtubePlayer . playVideo ( ) ;
392- expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe ( YT . PlayerState . PLAYING ) ;
395+ expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe (
396+ ( window as Window & { YT ?: typeof YT } ) . YT ! . PlayerState . PLAYING ,
397+ ) ;
393398
394399 events . onReady ( { target : playerSpy } ) ;
395400
@@ -401,7 +406,9 @@ describe('YoutubePlayer', () => {
401406 fixture . detectChanges ( ) ;
402407
403408 testComponent . youtubePlayer . pauseVideo ( ) ;
404- expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe ( YT . PlayerState . PAUSED ) ;
409+ expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe (
410+ ( window as Window & { YT ?: typeof YT } ) . YT ! . PlayerState . PAUSED ,
411+ ) ;
405412
406413 events . onReady ( { target : playerSpy } ) ;
407414
@@ -413,7 +420,9 @@ describe('YoutubePlayer', () => {
413420 fixture . detectChanges ( ) ;
414421
415422 testComponent . youtubePlayer . stopVideo ( ) ;
416- expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe ( YT . PlayerState . CUED ) ;
423+ expect ( testComponent . youtubePlayer . getPlayerState ( ) ) . toBe (
424+ ( window as Window & { YT ?: typeof YT } ) . YT ! . PlayerState . CUED ,
425+ ) ;
417426
418427 events . onReady ( { target : playerSpy } ) ;
419428
0 commit comments