diff --git a/src/lib/checkbox/checkbox.spec.ts b/src/lib/checkbox/checkbox.spec.ts index 180a4003fa7a..297307b40e94 100644 --- a/src/lib/checkbox/checkbox.spec.ts +++ b/src/lib/checkbox/checkbox.spec.ts @@ -710,6 +710,7 @@ describe('MdCheckbox', () => { let checkboxDebugElement: DebugElement; let checkboxInstance: MdCheckbox; let testComponent: CheckboxWithFormControl; + let inputElement: HTMLInputElement; beforeEach(() => { fixture = TestBed.createComponent(CheckboxWithFormControl); @@ -718,6 +719,7 @@ describe('MdCheckbox', () => { checkboxDebugElement = fixture.debugElement.query(By.directive(MdCheckbox)); checkboxInstance = checkboxDebugElement.componentInstance; testComponent = fixture.debugElement.componentInstance; + inputElement = checkboxDebugElement.nativeElement.querySelector('input'); }); it('should toggle the disabled state', () => { @@ -727,11 +729,13 @@ describe('MdCheckbox', () => { fixture.detectChanges(); expect(checkboxInstance.disabled).toBe(true); + expect(inputElement.disabled).toBe(true); testComponent.formControl.enable(); fixture.detectChanges(); expect(checkboxInstance.disabled).toBe(false); + expect(inputElement.disabled).toBe(false); }); }); }); diff --git a/src/lib/checkbox/checkbox.ts b/src/lib/checkbox/checkbox.ts index e7a69a412169..ef0d34d5e5ce 100644 --- a/src/lib/checkbox/checkbox.ts +++ b/src/lib/checkbox/checkbox.ts @@ -304,6 +304,7 @@ export class MdCheckbox implements ControlValueAccessor, AfterViewInit, OnDestro */ setDisabledState(isDisabled: boolean) { this.disabled = isDisabled; + this._changeDetectorRef.markForCheck(); } private _transitionCheckState(newState: TransitionCheckState) {