@@ -690,6 +690,46 @@ describe("ngAnimate", function() {
690
690
expect ( child . hasClass ( 'animation-cancelled' ) ) . toBe ( true ) ;
691
691
} ) ) ;
692
692
693
+ it ( "should remove the .ng-animate class after the next animation is run which interrupted the last animation" , function ( ) {
694
+ var addClassDone , removeClassDone ,
695
+ addClassDoneSpy = jasmine . createSpy ( ) ,
696
+ removeClassDoneSpy = jasmine . createSpy ( ) ;
697
+
698
+ module ( function ( $animateProvider ) {
699
+ $animateProvider . register ( '.hide' , function ( ) {
700
+ return {
701
+ addClass : function ( element , className , done ) {
702
+ addClassDone = done ;
703
+ return addClassDoneSpy ;
704
+ } ,
705
+ removeClass : function ( element , className , done ) {
706
+ removeClassDone = done ;
707
+ return removeClassDoneSpy ;
708
+ }
709
+ } ;
710
+ } ) ;
711
+ } ) ;
712
+
713
+ inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
714
+ $animate . addClass ( element , 'hide' ) ;
715
+
716
+ expect ( element ) . toHaveClass ( 'ng-animate' ) ;
717
+
718
+ $animate . triggerReflow ( ) ;
719
+
720
+ $animate . removeClass ( element , 'hide' ) ;
721
+ expect ( addClassDoneSpy ) . toHaveBeenCalled ( ) ;
722
+
723
+ $animate . triggerReflow ( ) ;
724
+
725
+ expect ( element ) . toHaveClass ( 'ng-animate' ) ;
726
+
727
+ removeClassDone ( ) ;
728
+ $animate . triggerCallbacks ( ) ;
729
+
730
+ expect ( element ) . not . toHaveClass ( 'ng-animate' ) ;
731
+ } ) ;
732
+ } ) ;
693
733
694
734
it ( "should skip a class-based animation if the same element already has an ongoing structural animation" ,
695
735
inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
0 commit comments