Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
tinayuangao committed Apr 13, 2017
1 parent ce16234 commit 4476218
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/checkbox/checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ describe('MdCheckbox', () => {
let checkboxDebugElement: DebugElement;
let checkboxInstance: MdCheckbox;
let testComponent: CheckboxWithFormControl;
let inputElement: HTMLInputElement;

beforeEach(() => {
fixture = TestBed.createComponent(CheckboxWithFormControl);
Expand All @@ -718,6 +719,7 @@ describe('MdCheckbox', () => {
checkboxDebugElement = fixture.debugElement.query(By.directive(MdCheckbox));
checkboxInstance = checkboxDebugElement.componentInstance;
testComponent = fixture.debugElement.componentInstance;
inputElement = <HTMLInputElement>checkboxDebugElement.nativeElement.querySelector('input');
});

it('should toggle the disabled state', () => {
Expand All @@ -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);
});
});
});
Expand Down

0 comments on commit 4476218

Please sign in to comment.