import { ComponentFixture , TestBed , async } from '@angular/core/testing' ; import { BannerTitleComponent } from './banner-title.component' ; describe ( 'BannerTitleComponent' , ( ) => { let component ; let fixture ; let h1 ; beforeEach ( async ( ( ) => { TestBed . configureTestingModule ( { declarations : [ BannerTitleComponent ] } ) . compileComponents ( ) ; } ) ) ; beforeEach ( ( ) => { fixture = TestBed . createComponent ( BannerTitleComponent ) ; component = fixture . componentInstance ; h1 = fixture . nativeElement . querySelector ( 'h1' ) ; fixture . detectChanges ( ) ; } ) ; it ( 'should create' , ( ) => { expect ( component ) . toBeTruthy ( ) ; } ) ; it ( 'should display original title' , ( ) => { expect ( h1 . textContent ) . toContain ( component . title ) ; } ) ; it ( 'should display a different test title' , ( ) => { component . title = 'Test Title' ; fixture . detectChanges ( ) ; expect ( h1 . textContent ) . toContain ( 'Test Title' ) ; } ) ; } ) ;