File tree 2 files changed +21
-0
lines changed 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,8 @@ describe('MatCheckbox', () => {
220
220
221
221
expect ( checkboxInstance . checked ) . toBe ( false ) ;
222
222
expect ( checkboxInstance . indeterminate ) . toBe ( false ) ;
223
+
224
+ flush ( ) ;
223
225
} ) ) ;
224
226
225
227
it ( 'should add and remove disabled state' , ( ) => {
@@ -539,6 +541,19 @@ describe('MatCheckbox', () => {
539
541
it ( 'should not initially have any transition classes' , ( ) => {
540
542
expect ( checkboxNativeElement ) . not . toMatch ( / ^ m a t \- c h e c k b o x \- a n i m / g) ;
541
543
} ) ;
544
+
545
+ it ( 'should not have transition classes when animation ends' , fakeAsync ( ( ) => {
546
+ testComponent . isIndeterminate = true ;
547
+ fixture . detectChanges ( ) ;
548
+
549
+ expect ( checkboxNativeElement . classList )
550
+ . toContain ( 'mat-checkbox-anim-unchecked-indeterminate' ) ;
551
+
552
+ flush ( ) ;
553
+
554
+ expect ( checkboxNativeElement . classList )
555
+ . not . toContain ( 'mat-checkbox-anim-unchecked-indeterminate' ) ;
556
+ } ) ) ;
542
557
} ) ;
543
558
544
559
describe ( `when MAT_CHECKBOX_CLICK_ACTION is 'check'` , ( ) => {
Original file line number Diff line number Diff line change @@ -291,6 +291,12 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
291
291
292
292
if ( this . _currentAnimationClass . length > 0 ) {
293
293
element . classList . add ( this . _currentAnimationClass ) ;
294
+
295
+ // Remove the animation class to avoid animation when the checkbox is moved between containers
296
+ const animationClass = this . _currentAnimationClass ;
297
+ setTimeout ( ( ) => {
298
+ element . classList . remove ( animationClass ) ;
299
+ } , 1000 ) ;
294
300
}
295
301
}
296
302
You can’t perform that action at this time.
0 commit comments