Skip to content

Commit be5ce28

Browse files
devversionandrewseguin
authored andcommitted
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: 1bbfcf4.
1 parent f2211e7 commit be5ce28

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,16 @@ describe('MatSnackBar', () => {
192192
}));
193193

194194

195-
it('should default to the passed message for the announcement message', fakeAsync(() => {
195+
it('should clear the announcement message if it is the same as main message', fakeAsync(() => {
196196
spyOn(liveAnnouncer, 'announce');
197197

198-
snackBar.open(simpleMessage);
198+
snackBar.open(simpleMessage, undefined, {announcementMessage: simpleMessage});
199199
viewContainerFixture.detectChanges();
200200

201201
expect(overlayContainerElement.childElementCount)
202202
.toBe(1, 'Expected the overlay with the default announcement message to be added');
203203

204-
// Expect the live announcer to have been called with the display message and some
205-
// string for the politeness. We do not want to test for the default politeness here.
206-
expect(liveAnnouncer.announce).toHaveBeenCalledWith(simpleMessage, jasmine.any(String));
204+
expect(liveAnnouncer.announce).not.toHaveBeenCalled();
207205
}));
208206

209207
it('should be able to specify a custom announcement message', fakeAsync(() => {

0 commit comments

Comments
 (0)