Skip to content

Commit cf12806

Browse files
committed
fixup! fix(material/snack-bar): switch away from animations module
1 parent 06bff69 commit cf12806

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

src/material/snack-bar/snack-bar-container.ts

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,13 @@ export class MatSnackBarContainer extends BasePortalOutlet implements OnDestroy
176176
if (!this._destroyed) {
177177
this._screenReaderAnnounce();
178178

179-
if (this._animationsDisabled) {
180-
this._completeEnter();
181-
} else {
182-
// Guarantees that the animation-related events will
183-
// fire even if something interrupts the animation.
184-
clearTimeout(this._enterFallback);
185-
this._enterFallback = setTimeout(this._completeEnter, 200);
186-
}
179+
// Guarantees that the animation-related events will
180+
// fire even if something interrupts the animation.
181+
clearTimeout(this._enterFallback);
182+
this._enterFallback = setTimeout(
183+
this._completeEnter,
184+
this._animationsDisabled ? undefined : 200,
185+
);
187186
}
188187
}
189188

@@ -198,16 +197,10 @@ export class MatSnackBarContainer extends BasePortalOutlet implements OnDestroy
198197
// long enough to visually read it either, so clear the timeout for announcing.
199198
clearTimeout(this._announceTimeoutId);
200199

201-
if (this._animationsDisabled) {
202-
// It's common for snack bars to be opened by random outside calls like HTTP requests or
203-
// errors. Run inside the NgZone to ensure that it functions correctly.
204-
this._ngZone.run(this._completeExit);
205-
} else {
206-
// Guarantees that the animation-related events will
207-
// fire even if something interrupts the animation.
208-
clearTimeout(this._exitFallback);
209-
this._exitFallback = setTimeout(this._completeExit, 150);
210-
}
200+
// Guarantees that the animation-related events will
201+
// fire even if something interrupts the animation.
202+
clearTimeout(this._exitFallback);
203+
this._exitFallback = setTimeout(this._completeExit, this._animationsDisabled ? undefined : 150);
211204

212205
return this._onExit;
213206
}

src/material/snack-bar/snack-bar.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ describe('MatSnackBar', () => {
564564
viewContainerFixture.detectChanges();
565565
}
566566

567-
flush();
567+
flush(50);
568568
expect(overlayContainerElement.querySelectorAll('mat-snack-bar-container').length).toBe(1);
569569
}));
570570

0 commit comments

Comments
 (0)