fix(checkbox): setting blank aria-label by default (#10281)

Fixes the checkbox adding a blank `aria-label` to the underlying input element by default.
This commit is contained in:
Kristiyan Kostadinov
2018-03-09 10:36:09 -05:00
committed by Jeremy Elbourn
parent 26ee3e77fc
commit c12d7c473e
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
[attr.name]="name"
[tabIndex]="tabIndex"
[indeterminate]="indeterminate"
[attr.aria-label]="ariaLabel"
[attr.aria-label]="ariaLabel || null"
[attr.aria-labelledby]="ariaLabelledby"
[attr.aria-checked]="_getAriaChecked()"
(change)="_onInteractionEvent($event)"
+8 -1
View File
@@ -701,7 +701,7 @@ describe('MatCheckbox', () => {
}));
});
describe('with provided aria-label ', () => {
describe('aria-label ', () => {
let checkboxDebugElement: DebugElement;
let checkboxNativeElement: HTMLElement;
let inputElement: HTMLInputElement;
@@ -715,6 +715,13 @@ describe('MatCheckbox', () => {
fixture.detectChanges();
expect(inputElement.getAttribute('aria-label')).toBe('Super effective');
});
it('should not set the aria-label attribute if no value is provided', () => {
fixture = TestBed.createComponent(SingleCheckbox);
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('input').hasAttribute('aria-label')).toBe(false);
});
});
describe('with provided aria-labelledby ', () => {