@@ -841,6 +841,49 @@ describe("ngAnimate", function() {
841
841
} ) ) ;
842
842
843
843
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
+
844
887
it ( "should stagger items when multiple animation durations/delays are defined" ,
845
888
inject ( function ( $animate , $rootScope , $compile , $sniffer , $timeout , $document , $rootElement ) {
846
889
@@ -3013,7 +3056,7 @@ describe("ngAnimate", function() {
3013
3056
} ) ) ;
3014
3057
3015
3058
3016
- it ( 'should block and unblock keyframe animations around the reflow operation' ,
3059
+ it ( 'should not block keyframe animations around the reflow operation' ,
3017
3060
inject ( function ( $rootScope , $compile , $rootElement , $document , $animate , $sniffer , $timeout ) {
3018
3061
3019
3062
if ( ! $sniffer . animations ) return ;
@@ -3032,15 +3075,19 @@ describe("ngAnimate", function() {
3032
3075
3033
3076
$animate . addClass ( element , 'trigger-class' ) ;
3034
3077
3035
- expect ( node . style [ animationKey ] ) . toContain ( 'none' ) ;
3078
+ expect ( node . style [ animationKey ] ) . not . toContain ( 'none' ) ;
3036
3079
3037
3080
$animate . triggerReflow ( ) ;
3038
3081
3039
3082
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' ) ;
3040
3087
} ) ) ;
3041
3088
3042
3089
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 ( ) {
3044
3091
module ( function ( $animateProvider ) {
3045
3092
$animateProvider . register ( '.special' , function ( $sniffer , $window ) {
3046
3093
var prop = $sniffer . vendorPrefix == 'Webkit' ? 'WebkitAnimation' : 'animation' ;
@@ -3076,8 +3123,8 @@ describe("ngAnimate", function() {
3076
3123
3077
3124
var prop = $sniffer . vendorPrefix == 'Webkit' ? 'WebkitAnimation' : 'animation' ;
3078
3125
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 ' ) ;
3081
3128
3082
3129
$animate . triggerReflow ( ) ;
3083
3130
} ) ;
0 commit comments