Skip to content

Commit f0b9f95

Browse files
committed
Refactor test to account for animations.
1 parent fa3f536 commit f0b9f95

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/lib/dialog/dialog.spec.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('MdDialog', () => {
163163
})).toBe(ref);
164164
});
165165

166-
it('should notify the observers if all open dialogs have finished closing', () => {
166+
it('should notify the observers if all open dialogs have finished closing', async(() => {
167167
const ref1 = dialog.open(PizzaMsg, {
168168
viewContainerRef: testViewContainerRef
169169
});
@@ -177,10 +177,19 @@ describe('MdDialog', () => {
177177
});
178178

179179
ref1.close();
180-
expect(allClosed).toBeFalsy();
181-
ref2.close();
182-
expect(allClosed).toBeTruthy();
183-
});
180+
viewContainerFixture.detectChanges();
181+
182+
viewContainerFixture.whenStable().then(() => {
183+
expect(allClosed).toBeFalsy();
184+
185+
ref2.close();
186+
viewContainerFixture.detectChanges();
187+
188+
viewContainerFixture.whenStable().then(() => {
189+
expect(allClosed).toBeTruthy();
190+
});
191+
});
192+
}));
184193

185194
it('should should override the width of the overlay pane', () => {
186195
dialog.open(PizzaMsg, {

0 commit comments

Comments
 (0)