From 223caaa89f0f16ac8e31a605fc6d2561854824b1 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 15 Jul 2020 00:11:01 +0200 Subject: [PATCH] test: fix failing MDC snackbar test (#19974) The MDC-based snackbar tests are currently failing because we landed a change in the non-MDC snackbar that propagates to the MDC-based snack bar. That is expected, but the test for the MDC-based snackbar have not been updated accordingly. See: https://github.com/angular/components/commit/1bbfcf40958b7b31e69dc9e19fc2acd237dde1dd. --- src/material-experimental/mdc-snack-bar/snack-bar.spec.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts b/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts index 17e2f40a4bfc..1eddc9b3f1ce 100644 --- a/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts +++ b/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts @@ -192,18 +192,16 @@ describe('MatSnackBar', () => { })); - it('should default to the passed message for the announcement message', fakeAsync(() => { + it('should clear the announcement message if it is the same as main message', fakeAsync(() => { spyOn(liveAnnouncer, 'announce'); - snackBar.open(simpleMessage); + snackBar.open(simpleMessage, undefined, {announcementMessage: simpleMessage}); viewContainerFixture.detectChanges(); expect(overlayContainerElement.childElementCount) .toBe(1, 'Expected the overlay with the default announcement message to be added'); - // Expect the live announcer to have been called with the display message and some - // string for the politeness. We do not want to test for the default politeness here. - expect(liveAnnouncer.announce).toHaveBeenCalledWith(simpleMessage, jasmine.any(String)); + expect(liveAnnouncer.announce).not.toHaveBeenCalled(); })); it('should be able to specify a custom announcement message', fakeAsync(() => {