@@ -351,6 +351,44 @@ describe('ngAnimate integration tests', function() {
351
351
352
352
dealoc ( element ) ;
353
353
} ) ) ;
354
+
355
+
356
+ it ( "should not normalize classes in a follow-up animation to a joined class-based animation" ,
357
+ inject ( function ( $animate , $animateCss , $rootScope , $document , $rootElement , $$rAF ) {
358
+
359
+ ss . addRule ( '.hide' , 'opacity: 0' ) ;
360
+ ss . addRule ( '.hide-add, .hide-remove' , 'transition: 1s linear all' ) ;
361
+
362
+ jqLite ( $document [ 0 ] . body ) . append ( $rootElement ) ;
363
+ element = jqLite ( '<div></div>' ) ;
364
+ $rootElement . append ( element ) ;
365
+
366
+ // These animations will be joined together
367
+ $animate . addClass ( element , 'red' ) ;
368
+ $animate . addClass ( element , 'hide' ) ;
369
+ $rootScope . $digest ( ) ;
370
+
371
+ expect ( element ) . toHaveClass ( 'red-add' ) ;
372
+ expect ( element ) . toHaveClass ( 'hide-add' ) ;
373
+
374
+ // When a digest has passed, but no $rAF has been issued yet, .hide hasn't been added to
375
+ // the element, which means class normalization does not allow .hide to get removed
376
+ $animate . removeClass ( element , 'hide' ) ;
377
+ $rootScope . $digest ( ) ;
378
+ $$rAF . flush ( ) ;
379
+
380
+ expect ( element ) . toHaveClass ( 'hide-remove hide-remove-active' ) ;
381
+
382
+ //End the animation process
383
+ browserTrigger ( element , 'transitionend' ,
384
+ { timeStamp : Date . now ( ) + 1000 , elapsedTime : 2 } ) ;
385
+ $animate . flush ( ) ;
386
+
387
+ expect ( element ) . not . toHaveClass ( 'hide-add-active red-add-active' ) ;
388
+ expect ( element ) . toHaveClass ( 'red' ) ;
389
+ expect ( element ) . not . toHaveClass ( 'hide' ) ;
390
+ } ) ) ;
391
+
354
392
} ) ;
355
393
356
394
describe ( 'JS animations' , function ( ) {
0 commit comments