fix(button-toggle): inaccurate name passed down to input if no name is assigned (#9017)

Fixes the button toggle setting the underlying input's name to `"undefined"` if the consumer hasn't passed in a name.
This commit is contained in:
Kristiyan Kostadinov
2018-01-23 17:16:46 +01:00
committed by Jeremy Elbourn
parent b153947300
commit 54d60df351
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
[id]="inputId"
[checked]="checked"
[disabled]="disabled || null"
[name]="name"
[attr.name]="name"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledby"
(change)="_onInputChange($event)"
@@ -578,6 +578,10 @@ describe('MatButtonToggle without forms', () => {
expect(document.activeElement).toBe(nativeRadioInput);
});
it('should not assign a name to the underlying input if one is not passed in', () => {
expect(buttonToggleNativeElement.querySelector('input')!.getAttribute('name')).toBeFalsy();
});
});
describe('with provided aria-label ', () => {