@@ -841,6 +841,49 @@ describe("ngAnimate", function() {
841841 } ) ) ;
842842
843843
844+ it ( "should block and unblock keyframe animations when a stagger animation kicks in while skipping the first element" ,
845+ inject ( function ( $animate , $rootScope , $compile , $sniffer , $timeout , $document , $rootElement ) {
846+
847+ if ( ! $sniffer . animations ) return ;
848+
849+ $animate . enabled ( true ) ;
850+
851+ ss . addRule ( '.blocked-animation.ng-enter' ,
852+ '-webkit-animation:my_animation 1s;' +
853+ 'animation:my_animation 1s;' ) ;
854+
855+ ss . addRule ( '.blocked-animation.ng-enter-stagger' ,
856+ '-webkit-animation-delay:0.2s;' +
857+ 'animation-delay:0.2s;' ) ;
858+
859+ var container = $compile ( html ( '<div></div>' ) ) ( $rootScope ) ;
860+
861+ var elements = [ ] ;
862+ for ( var i = 0 ; i < 4 ; i ++ ) {
863+ var newScope = $rootScope . $new ( ) ;
864+ var element = $compile ( '<div class="blocked-animation"></div>' ) ( newScope ) ;
865+ $animate . enter ( element , container ) ;
866+ elements . push ( element ) ;
867+ } ;
868+
869+ $rootScope . $digest ( ) ;
870+
871+ expect ( elements [ 0 ] . attr ( 'style' ) ) . toBeUndefined ( ) ;
872+ expect ( elements [ 1 ] . attr ( 'style' ) ) . toMatch ( / a n i m a t i o n : .* ?n o n e / ) ;
873+ expect ( elements [ 2 ] . attr ( 'style' ) ) . toMatch ( / a n i m a t i o n : .* ?n o n e / ) ;
874+ expect ( elements [ 3 ] . attr ( 'style' ) ) . toMatch ( / a n i m a t i o n : .* ?n o n e / ) ;
875+
876+ $animate . triggerReflow ( ) ;
877+
878+ expect ( elements [ 0 ] . attr ( 'style' ) ) . toBeUndefined ( ) ;
879+ expect ( elements [ 1 ] . attr ( 'style' ) ) . not . toMatch ( / a n i m a t i o n : .* ?n o n e / ) ;
880+ expect ( elements [ 1 ] . attr ( 'style' ) ) . toMatch ( / a n i m a t i o n - d e l a y : 0 .2 \d * s / ) ;
881+ expect ( elements [ 2 ] . attr ( 'style' ) ) . not . toMatch ( / a n i m a t i o n : .* ?n o n e / ) ;
882+ expect ( elements [ 2 ] . attr ( 'style' ) ) . toMatch ( / a n i m a t i o n - d e l a y : 0 .4 \d * s / ) ;
883+ expect ( elements [ 3 ] . attr ( 'style' ) ) . not . toMatch ( / a n i m a t i o n : .* ?n o n e / ) ;
884+ expect ( elements [ 3 ] . attr ( 'style' ) ) . toMatch ( / a n i m a t i o n - d e l a y : 0 .6 \d * s / ) ;
885+ } ) ) ;
886+
844887 it ( "should stagger items when multiple animation durations/delays are defined" ,
845888 inject ( function ( $animate , $rootScope , $compile , $sniffer , $timeout , $document , $rootElement ) {
846889
@@ -3013,7 +3056,7 @@ describe("ngAnimate", function() {
30133056 } ) ) ;
30143057
30153058
3016- it ( 'should block and unblock keyframe animations around the reflow operation' ,
3059+ it ( 'should not block keyframe animations around the reflow operation' ,
30173060 inject ( function ( $rootScope , $compile , $rootElement , $document , $animate , $sniffer , $timeout ) {
30183061
30193062 if ( ! $sniffer . animations ) return ;
@@ -3032,15 +3075,19 @@ describe("ngAnimate", function() {
30323075
30333076 $animate . addClass ( element , 'trigger-class' ) ;
30343077
3035- expect ( node . style [ animationKey ] ) . toContain ( 'none' ) ;
3078+ expect ( node . style [ animationKey ] ) . not . toContain ( 'none' ) ;
30363079
30373080 $animate . triggerReflow ( ) ;
30383081
30393082 expect ( node . style [ animationKey ] ) . not . toContain ( 'none' ) ;
3083+
3084+ browserTrigger ( element , 'animationend' , { timeStamp : Date . now ( ) + 1000 , elapsedTime : 1 } ) ;
3085+
3086+ expect ( node . style [ animationKey ] ) . not . toContain ( 'none' ) ;
30403087 } ) ) ;
30413088
30423089
3043- it ( 'should block and unblock keyframe animations before the followup JS animation occurs' , function ( ) {
3090+ it ( 'should not block keyframe animations at anytime before a followup JS animation occurs' , function ( ) {
30443091 module ( function ( $animateProvider ) {
30453092 $animateProvider . register ( '.special' , function ( $sniffer , $window ) {
30463093 var prop = $sniffer . vendorPrefix == 'Webkit' ? 'WebkitAnimation' : 'animation' ;
@@ -3076,8 +3123,8 @@ describe("ngAnimate", function() {
30763123
30773124 var prop = $sniffer . vendorPrefix == 'Webkit' ? 'WebkitAnimation' : 'animation' ;
30783125
3079- expect ( element [ 0 ] . style [ prop ] ) . toContain ( 'none' ) ;
3080- expect ( $window . getComputedStyle ( element [ 0 ] ) [ prop + 'Duration' ] ) . toBe ( '0s ' ) ;
3126+ expect ( element [ 0 ] . style [ prop ] ) . not . toContain ( 'none' ) ;
3127+ expect ( $window . getComputedStyle ( element [ 0 ] ) [ prop + 'Duration' ] ) . toBe ( '1s ' ) ;
30813128
30823129 $animate . triggerReflow ( ) ;
30833130 } ) ;
0 commit comments