mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Jeremy Elbourn
parent
b153947300
commit
54d60df351
@@ -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 ', () => {
|
||||
|
||||
Reference in New Issue
Block a user