11import { ComponentFixture , TestBed } from '@angular/core/testing' ;
22
33import { STORAGE_KEY_PREFIX , TopLevelBannerComponent } from './top-level-banner.component' ;
4- import { LOCAL_STORAGE } from '../../providers' ;
4+ import { LOCAL_STORAGE , WINDOW } from '../../providers' ;
55
66describe ( 'TopLevelBannerComponent' , ( ) => {
77 let component : TopLevelBannerComponent ;
@@ -15,12 +15,13 @@ describe('TopLevelBannerComponent', () => {
1515 beforeEach ( async ( ) => {
1616 mockLocalStorage = jasmine . createSpyObj ( 'Storage' , [ 'getItem' , 'setItem' ] ) ;
1717
18- await TestBed . configureTestingModule ( {
19- imports : [ TopLevelBannerComponent ] ,
20- providers : [ { provide : LOCAL_STORAGE , useValue : mockLocalStorage } ] ,
21- } ) . compileComponents ( ) ;
18+ fixture = TestBed . configureTestingModule ( {
19+ providers : [
20+ { provide : LOCAL_STORAGE , useValue : mockLocalStorage } ,
21+ { provide : WINDOW , useValue : { location : { origin : '' } } } ,
22+ ] ,
23+ } ) . createComponent ( TopLevelBannerComponent ) ;
2224
23- fixture = TestBed . createComponent ( TopLevelBannerComponent ) ;
2425 fixture . componentRef . setInput ( 'text' , EXAMPLE_TEXT ) ;
2526 fixture . componentRef . setInput ( 'id' , EXAMPLE_ID ) ;
2627
@@ -33,7 +34,7 @@ describe('TopLevelBannerComponent', () => {
3334 fixture . componentRef . setInput ( 'link' , EXAMPLE_LINK ) ;
3435 fixture . detectChanges ( ) ;
3536
36- const bannerElement = fixture . nativeElement . querySelector ( 'a.adev -top-level-banner' ) ;
37+ const bannerElement = fixture . nativeElement . querySelector ( 'a.docs -top-level-banner' ) ;
3738 expect ( bannerElement ) . toBeTruthy ( ) ;
3839 expect ( bannerElement . getAttribute ( 'href' ) ) . toBe ( EXAMPLE_LINK ) ;
3940 expect ( bannerElement . textContent ) . toContain ( EXAMPLE_TEXT ) ;
@@ -45,7 +46,7 @@ describe('TopLevelBannerComponent', () => {
4546 fixture . componentRef . setInput ( 'text' , EXAMPLE_TEXT ) ;
4647 fixture . detectChanges ( ) ;
4748
48- const bannerElement = fixture . nativeElement . querySelector ( 'div.adev -top-level-banner' ) ;
49+ const bannerElement = fixture . nativeElement . querySelector ( 'div.docs -top-level-banner' ) ;
4950 expect ( bannerElement ) . toBeTruthy ( ) ;
5051 expect ( bannerElement . textContent ) . toContain ( EXAMPLE_TEXT ) ;
5152 } ) ;
@@ -56,7 +57,7 @@ describe('TopLevelBannerComponent', () => {
5657 fixture . componentRef . setInput ( 'text' , EXAMPLE_TEXT ) ;
5758 fixture . detectChanges ( ) ;
5859
59- const bannerElement = fixture . nativeElement . querySelector ( '.adev -top-level-banner-cta' ) ;
60+ const bannerElement = fixture . nativeElement . querySelector ( '.docs -top-level-banner-cta' ) ;
6061 expect ( bannerElement ) . toBeTruthy ( ) ;
6162 expect ( bannerElement . textContent ) . toBe ( EXAMPLE_TEXT ) ;
6263 } ) ;
0 commit comments