@@ -250,6 +250,7 @@ describe('MatButtonToggle without forms', () => {
250
250
RepeatedButtonTogglesWithPreselectedValue ,
251
251
ButtonToggleWithTabindex ,
252
252
ButtonToggleWithStaticName ,
253
+ ButtonToggleWithStaticAriaAttributes ,
253
254
] ,
254
255
} ) ;
255
256
@@ -735,6 +736,16 @@ describe('MatButtonToggle without forms', () => {
735
736
fixture . detectChanges ( ) ;
736
737
expect ( buttonElement . getAttribute ( 'aria-label' ) ) . toBe ( 'Super effective' ) ;
737
738
} ) ;
739
+
740
+ it ( 'should clear the static aria from the host node' , ( ) => {
741
+ const fixture = TestBed . createComponent ( ButtonToggleWithStaticAriaAttributes ) ;
742
+ fixture . detectChanges ( ) ;
743
+ const hostNode : HTMLElement = fixture . nativeElement . querySelector ( 'mat-button-toggle' ) ;
744
+
745
+ expect ( hostNode . hasAttribute ( 'aria-label' ) ) . toBe ( false ) ;
746
+ expect ( hostNode . hasAttribute ( 'aria-labelledby' ) ) . toBe ( false ) ;
747
+ } ) ;
748
+
738
749
} ) ;
739
750
740
751
describe ( 'with provided aria-labelledby ' , ( ) => {
@@ -1006,3 +1017,11 @@ class ButtonToggleWithTabindex {}
1006
1017
template : `<mat-button-toggle name="custom-name"></mat-button-toggle>`
1007
1018
} )
1008
1019
class ButtonToggleWithStaticName { }
1020
+
1021
+
1022
+ @Component ( {
1023
+ template : `
1024
+ <mat-button-toggle aria-label="Toggle me" aria-labelledby="something"></mat-button-toggle>
1025
+ `
1026
+ } )
1027
+ class ButtonToggleWithStaticAriaAttributes { }
0 commit comments