@@ -690,6 +690,49 @@ describe("ngAnimate", function() {
690
690
expect ( child . hasClass ( 'animation-cancelled' ) ) . toBe ( true ) ;
691
691
} ) ) ;
692
692
693
+ it ( "should remove the .ng-animate className after a former animation was cancelled and then after the follow-up class-based animation has completed" , 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
+ ss . addRule ( '.hide' , '-webkit-transition:1s linear all;' +
715
+ 'transition:1s linear all;' ) ;
716
+
717
+ $animate . addClass ( element , 'hide' ) ;
718
+
719
+ expect ( element ) . toHaveClass ( 'ng-animate' ) ;
720
+
721
+ $animate . triggerReflow ( ) ;
722
+
723
+ $animate . removeClass ( element , 'hide' ) ;
724
+ expect ( addClassDoneSpy ) . toHaveBeenCalled ( ) ;
725
+
726
+ $animate . triggerReflow ( ) ;
727
+
728
+ expect ( element ) . toHaveClass ( 'ng-animate' ) ;
729
+
730
+ removeClassDone ( ) ;
731
+ $animate . triggerCallbacks ( ) ;
732
+
733
+ expect ( element ) . not . toHaveClass ( 'ng-animate' ) ;
734
+ } ) ;
735
+ } ) ;
693
736
694
737
it ( "should skip a class-based animation if the same element already has an ongoing structural animation" ,
695
738
inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
0 commit comments