import { async , ComponentFixture , TestBed , fakeAsync , } from '@angular/core/testing' ; import { Client } from '../../services/api/client' ; import { By } from '@angular/platform-browser' ; import { clientMock } from '../../../tests/client-mock.spec' ; import { NotificationsFlyoutComponent } from './flyout.component' ; import { MockComponent , MockDirective } from '../../utils/mock' ; import { RouterTestingModule } from '@angular/router/testing' ; import { FeaturesService } from '../../services/features.service' ; import { featuresServiceMock } from '../../../tests/features-service-mock.spec' ; import { NavigationStart , Router } from '@angular/router' ; import { IfFeatureDirective } from '../../common/directives/if-feature.directive' ; describe ( 'NotificationsFlyoutComponent' , ( ) => { let comp ; let fixture ; beforeEach ( async ( ( ) => { TestBed . configureTestingModule ( { declarations : [ MockDirective ( { selector : '[mdl]' , inputs : [ 'mdl' ] , } ) , MockComponent ( { selector : 'minds-notifications' , inputs : [ 'loadOnDemand' , 'hidden' , 'visible' , 'useOwnScrollSource' , 'showTabs' , 'showShadows' , 'showInfiniteScroll' , 'showElapsedTime' , ] , } , [ 'onVisible' ] ) , NotificationsFlyoutComponent , IfFeatureDirective , ] , imports : [ RouterTestingModule ] , providers : [ { provide : Client , useValue : clientMock , } , { provide : FeaturesService , useValue : featuresServiceMock , } , ] , } ) . compileComponents ( ) ; } ) ) ; beforeEach ( done => { jasmine . MAX_PRETTY_PRINT_DEPTH = 10 ; jasmine . clock ( ) . uninstall ( ) ; jasmine . clock ( ) . install ( ) ; featuresServiceMock . mock ( 'navigation' , false ) ; featuresServiceMock . mock ( 'notifications-v3' , false ) ; fixture = TestBed . createComponent ( NotificationsFlyoutComponent ) ; clientMock . response = { } ; comp = fixture . componentInstance ; fixture . detectChanges ( ) ; if ( fixture . isStable ( ) ) { done ( ) ; } else { fixture . whenStable ( ) . then ( ( ) => { done ( ) ; } ) ; } } ) ; afterEach ( ( ) => { jasmine . clock ( ) . uninstall ( ) ; } ) ; it ( 'Should emit close evt' , ( ) => { spyOn ( comp . closeEvt , 'emit' ) . and . callThrough ( ) ; comp . close ( ) ; expect ( comp . closeEvt . emit ) . toHaveBeenCalled ( ) ; } ) ; } ) ;