@@ -622,16 +622,22 @@ describe('MatButtonToggle without forms', () => {
622
622
623
623
} ) ;
624
624
625
- describe ( 'with provided aria-label ' , ( ) => {
626
- let checkboxDebugElement : DebugElement ;
627
- let checkboxNativeElement : HTMLElement ;
628
- let inputElement : HTMLInputElement ;
625
+ describe ( 'aria-label handling ' , ( ) => {
626
+ it ( 'should not set the aria-label attribute if none is provided' , ( ) => {
627
+ let fixture = TestBed . createComponent ( StandaloneButtonToggle ) ;
628
+ let checkboxDebugElement = fixture . debugElement . query ( By . directive ( MatButtonToggle ) ) ;
629
+ let checkboxNativeElement = checkboxDebugElement . nativeElement ;
630
+ let inputElement = checkboxNativeElement . querySelector ( 'input' ) as HTMLInputElement ;
631
+
632
+ fixture . detectChanges ( ) ;
633
+ expect ( inputElement . hasAttribute ( 'aria-label' ) ) . toBe ( false ) ;
634
+ } ) ;
629
635
630
636
it ( 'should use the provided aria-label' , ( ) => {
631
637
let fixture = TestBed . createComponent ( ButtonToggleWithAriaLabel ) ;
632
- checkboxDebugElement = fixture . debugElement . query ( By . directive ( MatButtonToggle ) ) ;
633
- checkboxNativeElement = checkboxDebugElement . nativeElement ;
634
- inputElement = checkboxNativeElement . querySelector ( 'input' ) as HTMLInputElement ;
638
+ let checkboxDebugElement = fixture . debugElement . query ( By . directive ( MatButtonToggle ) ) ;
639
+ let checkboxNativeElement = checkboxDebugElement . nativeElement ;
640
+ let inputElement = checkboxNativeElement . querySelector ( 'input' ) as HTMLInputElement ;
635
641
636
642
fixture . detectChanges ( ) ;
637
643
expect ( inputElement . getAttribute ( 'aria-label' ) ) . toBe ( 'Super effective' ) ;
0 commit comments