@@ -2771,4 +2771,47 @@ describe("ngAnimate", function() {
2771
2771
2772
2772
expect ( node . style [ animationKey ] ) . not . toContain ( 'none' ) ;
2773
2773
} ) ) ;
2774
+
2775
+ it ( 'should block and unblock keyframe animations before the followup JS animation occurs' , function ( ) {
2776
+ module ( function ( $animateProvider ) {
2777
+ $animateProvider . register ( '.special' , function ( $sniffer , $window ) {
2778
+ var prop = $sniffer . vendorPrefix == 'Webkit' ? 'WebkitAnimation' : 'animation' ;
2779
+ return {
2780
+ beforeAddClass : function ( element , className , done ) {
2781
+ expect ( element [ 0 ] . style [ prop ] ) . not . toContain ( 'none' ) ;
2782
+ expect ( $window . getComputedStyle ( element [ 0 ] ) [ prop + 'Duration' ] ) . toBe ( '1s' ) ;
2783
+ done ( ) ;
2784
+ } ,
2785
+ addClass : function ( element , className , done ) {
2786
+ expect ( element [ 0 ] . style [ prop ] ) . not . toContain ( 'none' ) ;
2787
+ expect ( $window . getComputedStyle ( element [ 0 ] ) [ prop + 'Duration' ] ) . toBe ( '1s' ) ;
2788
+ done ( ) ;
2789
+ }
2790
+ }
2791
+ } ) ;
2792
+ } ) ;
2793
+ inject ( function ( $rootScope , $compile , $rootElement , $document , $animate , $sniffer , $timeout , $window ) {
2794
+ if ( ! $sniffer . animations ) return ;
2795
+
2796
+ $animate . enabled ( true ) ;
2797
+
2798
+ ss . addRule ( '.special' , '-webkit-animation:1s special_animation;' +
2799
+ 'animation:1s special_animation;' ) ;
2800
+
2801
+ var capturedProperty = 'none' ;
2802
+
2803
+ var element = $compile ( '<div class="special"></div>' ) ( $rootScope ) ;
2804
+ $rootElement . append ( element ) ;
2805
+ jqLite ( $document [ 0 ] . body ) . append ( $rootElement ) ;
2806
+
2807
+ $animate . addClass ( element , 'some-klass' ) ;
2808
+
2809
+ var prop = $sniffer . vendorPrefix == 'Webkit' ? 'WebkitAnimation' : 'animation' ;
2810
+
2811
+ expect ( element [ 0 ] . style [ prop ] ) . toContain ( 'none' ) ;
2812
+ expect ( $window . getComputedStyle ( element [ 0 ] ) [ prop + 'Duration' ] ) . toBe ( '0s' ) ;
2813
+
2814
+ $timeout . flush ( ) ;
2815
+ } ) ;
2816
+ } ) ;
2774
2817
} ) ;
0 commit comments