import { DocumentDisplayModeComponent } from './document-display-mode.component' ; import { ComponentFixture , TestBed } from '@angular/core/testing' ; import { CoreModule } from '@angular/flex-layout' ; import { TranslateModule } from '@ngx-translate/core' ; import { AppTestingModule } from '../../../testing/app-testing.module' ; import { of } from 'rxjs' ; describe ( 'DocumentDisplayModeComponent' , ( ) => { let component ; let fixture ; beforeEach ( ( ) => { TestBed . configureTestingModule ( { imports : [ TranslateModule . forRoot ( ) , CoreModule , AppTestingModule ] } ) ; fixture = TestBed . createComponent ( DocumentDisplayModeComponent ) ; component = fixture . componentInstance ; } ) ; it ( 'should show the list button when list' , async ( ) => { component . displayMode$ = of ( 'list' ) ; fixture . detectChanges ( ) ; await fixture . whenStable ( ) ; const displayButton = fixture . nativeElement . querySelector ( '#app-document-display-mode-button' ) ; expect ( displayButton . title ) . toBe ( 'APP.ACTIONS.LIST_MODE' ) ; } ) ; it ( 'should show the gallery button when list' , async ( ) => { component . displayMode$ = of ( 'gallery' ) ; fixture . detectChanges ( ) ; await fixture . whenStable ( ) ; const displayButton = fixture . nativeElement . querySelector ( '#app-document-display-mode-button' ) ; expect ( displayButton . title ) . toBe ( 'APP.ACTIONS.GALLERY_MODE' ) ; } ) ; } ) ;