fix(radio-group): coerce disabled property (#5837)

This commit is contained in:
Paul Gschwendtner
2017-07-20 19:11:58 +02:00
committed by Kara
parent 804f4c077d
commit 23ec30f3a0
2 changed files with 15 additions and 2 deletions
+13
View File
@@ -67,11 +67,24 @@ describe('MdRadio', () => {
}
});
it('should coerce the disabled binding on the radio group', () => {
(groupInstance as any).disabled = '';
fixture.detectChanges();
radioLabelElements[0].click();
fixture.detectChanges();
expect(radioInstances[0].checked).toBe(false);
expect(groupInstance.disabled).toBe(true);
});
it('should disable click interaction when the group is disabled', () => {
testComponent.isGroupDisabled = true;
fixture.detectChanges();
radioLabelElements[0].click();
fixture.detectChanges();
expect(radioInstances[0].checked).toBe(false);
});
+2 -2
View File
@@ -186,11 +186,11 @@ export class MdRadioGroup extends _MdRadioGroupMixinBase
this._checkSelectedRadioButton();
}
/** Whether the radio group is diabled */
/** Whether the radio group is disabled */
@Input()
get disabled() { return this._disabled; }
set disabled(value) {
this._disabled = value;
this._disabled = coerceBooleanProperty(value);
this._markRadiosForCheck();
}