@@ -270,6 +270,7 @@ describe('MatButtonToggle without forms', () => {
270
270
ButtonToggleWithTabindex ,
271
271
ButtonToggleWithStaticName ,
272
272
ButtonToggleWithStaticChecked ,
273
+ ButtonToggleWithStaticAriaAttributes ,
273
274
] ,
274
275
} ) ;
275
276
@@ -751,6 +752,16 @@ describe('MatButtonToggle without forms', () => {
751
752
fixture . detectChanges ( ) ;
752
753
expect ( buttonElement . getAttribute ( 'aria-label' ) ) . toBe ( 'Super effective' ) ;
753
754
} ) ;
755
+
756
+ it ( 'should clear the static aria from the host node' , ( ) => {
757
+ const fixture = TestBed . createComponent ( ButtonToggleWithStaticAriaAttributes ) ;
758
+ fixture . detectChanges ( ) ;
759
+ const hostNode : HTMLElement = fixture . nativeElement . querySelector ( 'mat-button-toggle' ) ;
760
+
761
+ expect ( hostNode . hasAttribute ( 'aria-label' ) ) . toBe ( false ) ;
762
+ expect ( hostNode . hasAttribute ( 'aria-labelledby' ) ) . toBe ( false ) ;
763
+ } ) ;
764
+
754
765
} ) ;
755
766
756
767
describe ( 'with provided aria-labelledby ' , ( ) => {
@@ -1068,3 +1079,11 @@ class ButtonToggleWithStaticChecked {
1068
1079
@ViewChild ( MatButtonToggleGroup ) group : MatButtonToggleGroup ;
1069
1080
@ViewChildren ( MatButtonToggle ) toggles : QueryList < MatButtonToggle > ;
1070
1081
}
1082
+
1083
+
1084
+ @Component ( {
1085
+ template : `
1086
+ <mat-button-toggle aria-label="Toggle me" aria-labelledby="something"></mat-button-toggle>
1087
+ `
1088
+ } )
1089
+ class ButtonToggleWithStaticAriaAttributes { }
0 commit comments