Skip to content

test: fix failing MDC snackbar test #19974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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