Skip to content

Commit

Permalink
test: fix failing MDC snackbar test (#19974)
Browse files Browse the repository at this point in the history
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:
1bbfcf4.
  • Loading branch information
devversion authored Jul 14, 2020
1 parent 7b789d4 commit 223caaa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/material-experimental/mdc-snack-bar/snack-bar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 223caaa

Please sign in to comment.