File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 11
11
[attr.name] ="name "
12
12
[tabIndex] ="tabIndex "
13
13
[indeterminate] ="indeterminate "
14
- [attr.aria-label] ="ariaLabel "
14
+ [attr.aria-label] ="ariaLabel || null "
15
15
[attr.aria-labelledby] ="ariaLabelledby "
16
16
[attr.aria-checked] ="_getAriaChecked() "
17
17
(change) ="_onInteractionEvent($event) "
Original file line number Diff line number Diff line change @@ -701,7 +701,7 @@ describe('MatCheckbox', () => {
701
701
} ) ) ;
702
702
} ) ;
703
703
704
- describe ( 'with provided aria-label ' , ( ) => {
704
+ describe ( 'aria-label ' , ( ) => {
705
705
let checkboxDebugElement : DebugElement ;
706
706
let checkboxNativeElement : HTMLElement ;
707
707
let inputElement : HTMLInputElement ;
@@ -715,6 +715,13 @@ describe('MatCheckbox', () => {
715
715
fixture . detectChanges ( ) ;
716
716
expect ( inputElement . getAttribute ( 'aria-label' ) ) . toBe ( 'Super effective' ) ;
717
717
} ) ;
718
+
719
+ it ( 'should not set the aria-label attribute if no value is provided' , ( ) => {
720
+ fixture = TestBed . createComponent ( SingleCheckbox ) ;
721
+ fixture . detectChanges ( ) ;
722
+
723
+ expect ( fixture . nativeElement . querySelector ( 'input' ) . hasAttribute ( 'aria-label' ) ) . toBe ( false ) ;
724
+ } ) ;
718
725
} ) ;
719
726
720
727
describe ( 'with provided aria-labelledby ' , ( ) => {
You can’t perform that action at this time.
0 commit comments