@@ -271,6 +271,7 @@ describe('MatButtonToggle without forms', () => {
271
271
ButtonToggleWithTabindex ,
272
272
ButtonToggleWithStaticName ,
273
273
ButtonToggleWithStaticChecked ,
274
+ ButtonToggleWithStaticAriaAttributes ,
274
275
] ,
275
276
} ) ;
276
277
@@ -756,6 +757,16 @@ describe('MatButtonToggle without forms', () => {
756
757
fixture . detectChanges ( ) ;
757
758
expect ( buttonElement . getAttribute ( 'aria-label' ) ) . toBe ( 'Super effective' ) ;
758
759
} ) ;
760
+
761
+ it ( 'should clear the static aria from the host node' , ( ) => {
762
+ const fixture = TestBed . createComponent ( ButtonToggleWithStaticAriaAttributes ) ;
763
+ fixture . detectChanges ( ) ;
764
+ const hostNode : HTMLElement = fixture . nativeElement . querySelector ( 'mat-button-toggle' ) ;
765
+
766
+ expect ( hostNode . hasAttribute ( 'aria-label' ) ) . toBe ( false ) ;
767
+ expect ( hostNode . hasAttribute ( 'aria-labelledby' ) ) . toBe ( false ) ;
768
+ } ) ;
769
+
759
770
} ) ;
760
771
761
772
describe ( 'with provided aria-labelledby ' , ( ) => {
@@ -1073,3 +1084,11 @@ class ButtonToggleWithStaticChecked {
1073
1084
@ViewChild ( MatButtonToggleGroup ) group : MatButtonToggleGroup ;
1074
1085
@ViewChildren ( MatButtonToggle ) toggles : QueryList < MatButtonToggle > ;
1075
1086
}
1087
+
1088
+
1089
+ @Component ( {
1090
+ template : `
1091
+ <mat-button-toggle aria-label="Toggle me" aria-labelledby="something"></mat-button-toggle>
1092
+ `
1093
+ } )
1094
+ class ButtonToggleWithStaticAriaAttributes { }
0 commit comments