@@ -3,7 +3,6 @@ import {NgModule, Component, ViewChild, ViewContainerRef} from '@angular/core';
33import { TemplatePortalDirective , PortalModule } from '../portal/portal-directives' ;
44import { TemplatePortal , ComponentPortal } from '../portal/portal' ;
55import { Overlay } from './overlay' ;
6- import { OverlayRef } from './overlay-ref' ;
76import { OverlayContainer } from './overlay-container' ;
87import { OverlayState } from './overlay-state' ;
98import { PositionStrategy } from './position/position-strategy' ;
@@ -38,6 +37,7 @@ describe('Overlay', () => {
3837 fixture . detectChanges ( ) ;
3938 templatePortal = fixture . componentInstance . templatePortal ;
4039 componentPortal = new ComponentPortal ( PizzaMsg , fixture . componentInstance . viewContainerRef ) ;
40+ viewContainerFixture = fixture ;
4141 } ) ) ;
4242
4343 it ( 'should load a component into an overlay' , ( ) => {
@@ -103,20 +103,19 @@ describe('Overlay', () => {
103103 let config = new OverlayState ( ) ;
104104 config . hasBackdrop = true ;
105105
106- let overlayRef = overlay . create ( config ) . attach ( componentPortal ) ;
106+ let overlayRef = overlay . create ( config ) ;
107+ overlayRef . attach ( componentPortal ) ;
107108
108- viewContainerFixture . whenStable ( ) . then ( ( ) => {
109- viewContainerFixture . detectChanges ( ) ;
110- let backdrop = < HTMLElement > overlayContainerElement . querySelector ( '.md-overlay-backdrop' ) ;
111- expect ( backdrop ) . toBeTruthy ( ) ;
112- expect ( backdrop . classList ) . not . toContain ( '.md-overlay-backdrop-showing' ) ;
109+ viewContainerFixture . detectChanges ( ) ;
110+ let backdrop = < HTMLElement > overlayContainerElement . querySelector ( '.md-overlay-backdrop' ) ;
111+ expect ( backdrop ) . toBeTruthy ( ) ;
112+ expect ( backdrop . classList ) . not . toContain ( '.md-overlay-backdrop-showing' ) ;
113113
114- let backdropClickHandler = jasmine . createSpy ( 'backdropClickHander' ) ;
115- overlayRef . backdropClick ( ) . subscribe ( backdropClickHandler ) ;
114+ let backdropClickHandler = jasmine . createSpy ( 'backdropClickHander' ) ;
115+ overlayRef . backdropClick ( ) . subscribe ( backdropClickHandler ) ;
116116
117- backdrop . click ( ) ;
118- expect ( backdropClickHandler ) . toHaveBeenCalled ( ) ;
119- } ) ;
117+ backdrop . click ( ) ;
118+ expect ( backdropClickHandler ) . toHaveBeenCalled ( ) ;
120119 } ) ;
121120 } ) ;
122121} ) ;
0 commit comments