@@ -21,6 +21,7 @@ import {
2121 MatSnackBarModule ,
2222 MatSnackBarRef ,
2323} from './index' ;
24+ import { Platform } from '@angular/cdk/platform' ;
2425
2526describe ( 'MatSnackBar' , ( ) => {
2627 let snackBar : MatSnackBar ;
@@ -161,6 +162,30 @@ describe('MatSnackBar', () => {
161162 . toBe ( 'off' , 'Expected snack bar container live region to have aria-live="off"' ) ;
162163 } ) ;
163164
165+ it ( 'should have role of `alert` with an `assertive` politeness (Firefox only)' , ( ) => {
166+ const platform = TestBed . inject ( Platform ) ;
167+ snackBar . openFromComponent ( BurritosNotification , { politeness : 'assertive' } ) ;
168+ viewContainerFixture . detectChanges ( ) ;
169+
170+ const containerElement = overlayContainerElement . querySelector ( 'mat-mdc-snack-bar-container' ) ! ;
171+ const liveElement = containerElement . querySelector ( '[aria-live]' ) ! ;
172+
173+ expect ( liveElement . getAttribute ( 'role' ) )
174+ . toBe ( platform . FIREFOX ? 'alert' : null ) ;
175+ } ) ;
176+
177+ it ( 'should have role of `status` with an `polite` politeness (Firefox only)' , ( ) => {
178+ const platform = TestBed . inject ( Platform ) ;
179+ snackBar . openFromComponent ( BurritosNotification , { politeness : 'polite' } ) ;
180+ viewContainerFixture . detectChanges ( ) ;
181+
182+ const containerElement = overlayContainerElement . querySelector ( 'mat-mdc-snack-bar-container' ) ! ;
183+ const liveElement = containerElement . querySelector ( '[aria-live]' ) ! ;
184+
185+ expect ( liveElement . getAttribute ( 'role' ) )
186+ . toBe ( platform . FIREFOX ? 'status' : null ) ;
187+ } ) ;
188+
164189 it ( 'should have exactly one MDC label element when opened through simple snack bar' , ( ) => {
165190 let config : MatSnackBarConfig = { viewContainerRef : testViewContainerRef } ;
166191 snackBar . open ( simpleMessage , simpleActionLabel , config ) ;
0 commit comments