@@ -543,6 +543,43 @@ describe("ngAnimate", function() {
543
543
} ) ;
544
544
} ) ;
545
545
546
+ it ( "should clear the setClass element animation cache before the next animation runs" , function ( ) {
547
+ var animateSpy = jasmine . createSpy ( ) ;
548
+ module ( function ( $animateProvider ) {
549
+ $animateProvider . register ( '.track-me' , function ( ) {
550
+ return {
551
+ addClass : animateSpy ,
552
+ removeClass : animateSpy ,
553
+ setClass : animateSpy
554
+ } ;
555
+ } ) ;
556
+ } ) ;
557
+ inject ( function ( $animate , $rootScope , $sniffer , $$rAF ) {
558
+ var orphanChild = jqLite ( '<div class="track-me"></div>' ) ;
559
+ element . append ( orphanChild ) ;
560
+ orphanChild . remove ( ) ;
561
+
562
+ var doneSpy = jasmine . createSpy ( ) ;
563
+
564
+ $animate . setClass ( orphanChild , 'red' , 'blue' ) . then ( doneSpy ) ;
565
+ $rootScope . $digest ( ) ;
566
+ $animate . triggerCallbacks ( ) ;
567
+
568
+ expect ( doneSpy ) . toHaveBeenCalled ( ) ;
569
+ expect ( animateSpy ) . not . toHaveBeenCalled ( ) ;
570
+
571
+ var specialChild = jqLite ( '<div class="track-me"></div>' ) ;
572
+ element . append ( specialChild ) ;
573
+
574
+ $animate . setClass ( specialChild , 'blue' , 'gold' ) . then ( doneSpy ) ;
575
+ $rootScope . $digest ( ) ;
576
+ $animate . triggerReflow ( ) ;
577
+ $animate . triggerCallbacks ( ) ;
578
+
579
+ expect ( animateSpy ) . toHaveBeenCalled ( ) ;
580
+ } ) ;
581
+ } ) ;
582
+
546
583
it ( "should exclusively animate the setClass animation event with native dom elements" , function ( ) {
547
584
var count = 0 , fallback = jasmine . createSpy ( 'callback' ) ;
548
585
module ( function ( $animateProvider ) {
0 commit comments