Skip to content

Commit c2b0971

Browse files
committed
More checkbox animation to user interaction trigger
1 parent 4e4c6a6 commit c2b0971

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib/checkbox/checkbox.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,11 @@ describe('MdCheckbox', () => {
384384

385385
describe('state transition css classes', () => {
386386
it('should transition unchecked -> checked -> unchecked', () => {
387-
testComponent.isChecked = true;
387+
inputElement.click();
388388
fixture.detectChanges();
389389
expect(checkboxNativeElement.classList).toContain('mat-checkbox-anim-unchecked-checked');
390390

391-
testComponent.isChecked = false;
391+
inputElement.click();
392392
fixture.detectChanges();
393393
expect(checkboxNativeElement.classList)
394394
.not.toContain('mat-checkbox-anim-unchecked-checked');

src/lib/checkbox/checkbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ export class MdCheckbox implements ControlValueAccessor {
195195
this.indeterminateChange.emit(this._indeterminate);
196196
}
197197
this._checked = checked;
198-
this._transitionCheckState(
199-
this._checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
200198
this._changeDetectorRef.markForCheck();
201199
}
202200
}
@@ -348,6 +346,8 @@ export class MdCheckbox implements ControlValueAccessor {
348346

349347
if (!this.disabled) {
350348
this.toggle();
349+
this._transitionCheckState(
350+
this._checked ? TransitionCheckState.Checked : TransitionCheckState.Unchecked);
351351

352352
// Emit our custom change event if the native input emitted one.
353353
// It is important to only emit it, if the native input triggered one, because

0 commit comments

Comments
 (0)