@@ -3,7 +3,6 @@ import {NgModule, Component, ViewChild, ViewContainerRef} from '@angular/core';
3
3
import { TemplatePortalDirective , PortalModule } from '../portal/portal-directives' ;
4
4
import { TemplatePortal , ComponentPortal } from '../portal/portal' ;
5
5
import { Overlay } from './overlay' ;
6
- import { OverlayRef } from './overlay-ref' ;
7
6
import { OverlayContainer } from './overlay-container' ;
8
7
import { OverlayState } from './overlay-state' ;
9
8
import { PositionStrategy } from './position/position-strategy' ;
@@ -38,6 +37,7 @@ describe('Overlay', () => {
38
37
fixture . detectChanges ( ) ;
39
38
templatePortal = fixture . componentInstance . templatePortal ;
40
39
componentPortal = new ComponentPortal ( PizzaMsg , fixture . componentInstance . viewContainerRef ) ;
40
+ viewContainerFixture = fixture ;
41
41
} ) ) ;
42
42
43
43
it ( 'should load a component into an overlay' , ( ) => {
@@ -103,20 +103,19 @@ describe('Overlay', () => {
103
103
let config = new OverlayState ( ) ;
104
104
config . hasBackdrop = true ;
105
105
106
- let overlayRef = overlay . create ( config ) . attach ( componentPortal ) ;
106
+ let overlayRef = overlay . create ( config ) ;
107
+ overlayRef . attach ( componentPortal ) ;
107
108
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' ) ;
113
113
114
- let backdropClickHandler = jasmine . createSpy ( 'backdropClickHander' ) ;
115
- overlayRef . backdropClick ( ) . subscribe ( backdropClickHandler ) ;
114
+ let backdropClickHandler = jasmine . createSpy ( 'backdropClickHander' ) ;
115
+ overlayRef . backdropClick ( ) . subscribe ( backdropClickHandler ) ;
116
116
117
- backdrop . click ( ) ;
118
- expect ( backdropClickHandler ) . toHaveBeenCalled ( ) ;
119
- } ) ;
117
+ backdrop . click ( ) ;
118
+ expect ( backdropClickHandler ) . toHaveBeenCalled ( ) ;
120
119
} ) ;
121
120
} ) ;
122
121
} ) ;
0 commit comments