Skip to content

Commit 23ec30f

Browse files
devversionkara
authored andcommitted
fix(radio-group): coerce disabled property (#5837)
1 parent 804f4c0 commit 23ec30f

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/lib/radio/radio.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,24 @@ describe('MdRadio', () => {
6767
}
6868
});
6969

70+
it('should coerce the disabled binding on the radio group', () => {
71+
(groupInstance as any).disabled = '';
72+
fixture.detectChanges();
73+
74+
radioLabelElements[0].click();
75+
fixture.detectChanges();
76+
77+
expect(radioInstances[0].checked).toBe(false);
78+
expect(groupInstance.disabled).toBe(true);
79+
});
80+
7081
it('should disable click interaction when the group is disabled', () => {
7182
testComponent.isGroupDisabled = true;
7283
fixture.detectChanges();
7384

7485
radioLabelElements[0].click();
86+
fixture.detectChanges();
87+
7588
expect(radioInstances[0].checked).toBe(false);
7689
});
7790

src/lib/radio/radio.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ export class MdRadioGroup extends _MdRadioGroupMixinBase
186186
this._checkSelectedRadioButton();
187187
}
188188

189-
/** Whether the radio group is diabled */
189+
/** Whether the radio group is disabled */
190190
@Input()
191191
get disabled() { return this._disabled; }
192192
set disabled(value) {
193-
this._disabled = value;
193+
this._disabled = coerceBooleanProperty(value);
194194
this._markRadiosForCheck();
195195
}
196196

0 commit comments

Comments
 (0)