Skip to content

Commit

Permalink
fix(radio-group): coerce disabled property (#5837)
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion authored and kara committed Jul 20, 2017
1 parent 804f4c0 commit 23ec30f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/lib/radio/radio.spec.ts
Expand Up @@ -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);
});

Expand Down
4 changes: 2 additions & 2 deletions src/lib/radio/radio.ts
Expand Up @@ -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();
}

Expand Down

0 comments on commit 23ec30f

Please sign in to comment.