@@ -37,7 +37,9 @@ function waitOnEvent(fixture: ComponentFixture,
37
37
// Wait for the animation end.
38
38
let completer = PromiseWrapper . completer ( ) ;
39
39
let component : any = fixture . debugElement . query ( by ) . componentInstance ;
40
- component [ propertyName ] . subscribe ( completer . resolve ) ;
40
+ component [ propertyName ] . subscribe ( ( ) => {
41
+ completer . resolve ( ) ;
42
+ } ) ;
41
43
return completer . promise ;
42
44
}
43
45
@@ -59,16 +61,18 @@ export function main() {
59
61
. then ( ( f ) => {
60
62
fixture = f ;
61
63
testComponent = fixture . debugElement . componentInstance ;
62
-
64
+ fixture . detectChanges ( ) ;
65
+ return wait ( 1 ) ;
66
+ } ) . then ( ( f ) => {
63
67
let openButtonElement = fixture . debugElement . query ( By . css ( '.open' ) ) ;
64
68
openButtonElement . nativeElement . click ( ) ;
65
- } )
66
- . then ( ( _ : any ) => { wait ( 1 ) ; } )
67
- . then ( ( _ : any ) => {
69
+ fixture . detectChanges ( ) ;
70
+ return wait ( 1 ) ;
71
+ } ) . then ( ( _ : any ) => {
68
72
expect ( testComponent . openStartCount ) . toBe ( 1 ) ;
69
73
expect ( testComponent . openCount ) . toBe ( 0 ) ;
70
74
} )
71
- . then ( ( _ : any ) => waitOnEvent ( fixture , By . directive ( MdSidenav ) , 'onOpen' ) )
75
+ . then ( ( _ : any ) => { return waitOnEvent ( fixture , By . directive ( MdSidenav ) , 'onOpen' ) ; } )
72
76
. then ( ( _ : any ) => {
73
77
expect ( testComponent . openStartCount ) . toBe ( 1 ) ;
74
78
expect ( testComponent . openCount ) . toBe ( 1 ) ;
@@ -83,6 +87,8 @@ export function main() {
83
87
// Close it.
84
88
let closeButtonElement = fixture . debugElement . query ( By . css ( '.close' ) ) ;
85
89
closeButtonElement . nativeElement . click ( ) ;
90
+ fixture . detectChanges ( ) ;
91
+ return wait ( 1 ) ;
86
92
} )
87
93
. then ( ( _ : any ) => wait ( 1 ) )
88
94
. then ( ( _ : any ) => {
@@ -91,7 +97,7 @@ export function main() {
91
97
expect ( testComponent . closeStartCount ) . toBe ( 1 ) ;
92
98
expect ( testComponent . closeCount ) . toBe ( 0 ) ;
93
99
} )
94
- . then ( ( _ : any ) => waitOnEvent ( fixture , By . directive ( MdSidenav ) , 'onClose' ) )
100
+ . then ( ( _ : any ) => { return waitOnEvent ( fixture , By . directive ( MdSidenav ) , 'onClose' ) ; } )
95
101
. then ( ( _ : any ) => fixture . detectChanges ( ) )
96
102
. then ( ( _ : any ) => {
97
103
expect ( testComponent . openStartCount ) . toBe ( 1 ) ;
@@ -123,7 +129,7 @@ export function main() {
123
129
promise = sidenav . open ( ) ;
124
130
promise . then ( ( _ : any ) => called = true ) ;
125
131
} )
126
- . then ( ( _ : any ) => wait ( 1 ) )
132
+ . then ( ( _ : any ) => { return wait ( 1 ) ; } )
127
133
. then ( ( _ : any ) => fixture . detectChanges ( ) )
128
134
. then ( ( _ : any ) => {
129
135
expect ( called ) . toBe ( false ) ;
@@ -136,7 +142,7 @@ export function main() {
136
142
promise = sidenav . close ( ) ;
137
143
promise . then ( ( _ : any ) => called = true ) ;
138
144
} )
139
- . then ( ( _ : any ) => wait ( 1 ) )
145
+ . then ( ( _ : any ) => { return wait ( 1 ) ; } )
140
146
. then ( ( _ : any ) => fixture . detectChanges ( ) )
141
147
. then ( ( _ : any ) => {
142
148
expect ( called ) . toBe ( false ) ;
@@ -160,7 +166,7 @@ export function main() {
160
166
promise = sidenav . open ( ) ;
161
167
expect ( sidenav . open ( ) ) . toBe ( promise ) ;
162
168
} )
163
- . then ( ( _ : any ) => wait ( 1 ) )
169
+ . then ( ( _ : any ) => { return wait ( 1 ) ; } )
164
170
. then ( ( _ : any ) => {
165
171
fixture . detectChanges ( ) ;
166
172
return promise ;
@@ -195,10 +201,10 @@ export function main() {
195
201
openCancelled = true ;
196
202
} ) ;
197
203
} )
198
- . then ( ( _ : any ) => wait ( 1 ) )
204
+ . then ( ( _ : any ) => { return wait ( 1 ) ; } )
199
205
. then ( ( _ : any ) => fixture . detectChanges ( ) )
200
206
// We need to wait for the browser to start the transition.
201
- . then ( ( _ : any ) => wait ( 50 ) )
207
+ . then ( ( _ : any ) => { return wait ( 50 ) ; } )
202
208
. then ( ( _ : any ) => {
203
209
closePromise = sidenav . close ( ) . then ( ( _ : any ) => {
204
210
closeCalled = true ;
@@ -237,7 +243,7 @@ export function main() {
237
243
/** First, open it. */
238
244
openPromise = sidenav . open ( ) ;
239
245
} )
240
- . then ( ( _ : any ) => wait ( 1 ) )
246
+ . then ( ( _ : any ) => { return wait ( 1 ) ; } )
241
247
. then ( ( _ : any ) => {
242
248
fixture . detectChanges ( ) ;
243
249
return openPromise ;
@@ -251,10 +257,10 @@ export function main() {
251
257
closeCancelled = true ;
252
258
} ) ;
253
259
} )
254
- . then ( ( _ : any ) => wait ( 1 ) )
260
+ . then ( ( _ : any ) => { return wait ( 1 ) ; } )
255
261
. then ( ( _ : any ) => fixture . detectChanges ( ) )
256
262
// We need to wait for the browser to start the transition.
257
- . then ( ( _ : any ) => wait ( 50 ) )
263
+ . then ( ( _ : any ) => { return wait ( 50 ) ; } )
258
264
. then ( ( _ : any ) => {
259
265
openPromise = sidenav . open ( ) . then ( ( _ : any ) => {
260
266
openCalled = true ;
0 commit comments