File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,8 @@ describe('MatCheckbox', () => {
220220
221221 expect ( checkboxInstance . checked ) . toBe ( false ) ;
222222 expect ( checkboxInstance . indeterminate ) . toBe ( false ) ;
223+
224+ flush ( ) ;
223225 } ) ) ;
224226
225227 it ( 'should add and remove disabled state' , ( ) => {
@@ -539,6 +541,19 @@ describe('MatCheckbox', () => {
539541 it ( 'should not initially have any transition classes' , ( ) => {
540542 expect ( checkboxNativeElement ) . not . toMatch ( / ^ m a t \- c h e c k b o x \- a n i m / g) ;
541543 } ) ;
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+ } ) ) ;
542557 } ) ;
543558
544559 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
291291
292292 if ( this . _currentAnimationClass . length > 0 ) {
293293 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 ) ;
294300 }
295301 }
296302
You can’t perform that action at this time.
0 commit comments