@@ -783,6 +783,46 @@ describe("ngAnimate", function() {
783
783
expect ( child . hasClass ( 'animation-cancelled' ) ) . toBe ( true ) ;
784
784
} ) ) ;
785
785
786
+ it ( "should remove the .ng-animate class after the next animation is run which interrupted the last animation" , function ( ) {
787
+ var addClassDone , removeClassDone ,
788
+ addClassDoneSpy = jasmine . createSpy ( ) ,
789
+ removeClassDoneSpy = jasmine . createSpy ( ) ;
790
+
791
+ module ( function ( $animateProvider ) {
792
+ $animateProvider . register ( '.hide' , function ( ) {
793
+ return {
794
+ addClass : function ( element , className , done ) {
795
+ addClassDone = done ;
796
+ return addClassDoneSpy ;
797
+ } ,
798
+ removeClass : function ( element , className , done ) {
799
+ removeClassDone = done ;
800
+ return removeClassDoneSpy ;
801
+ }
802
+ } ;
803
+ } ) ;
804
+ } ) ;
805
+
806
+ inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
807
+ $animate . addClass ( element , 'hide' ) ;
808
+
809
+ expect ( element ) . toHaveClass ( 'ng-animate' ) ;
810
+
811
+ $animate . triggerReflow ( ) ;
812
+
813
+ $animate . removeClass ( element , 'hide' ) ;
814
+ expect ( addClassDoneSpy ) . toHaveBeenCalled ( ) ;
815
+
816
+ $animate . triggerReflow ( ) ;
817
+
818
+ expect ( element ) . toHaveClass ( 'ng-animate' ) ;
819
+
820
+ removeClassDone ( ) ;
821
+ $animate . triggerCallbacks ( ) ;
822
+
823
+ expect ( element ) . not . toHaveClass ( 'ng-animate' ) ;
824
+ } ) ;
825
+ } ) ;
786
826
787
827
it ( "should skip a class-based animation if the same element already has an ongoing structural animation" ,
788
828
inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
0 commit comments