@@ -634,6 +634,86 @@ describe("ngAnimate $animateCss", function() {
634
634
keyframeProgress ( element , 1 , 20 ) ;
635
635
assertAnimationComplete ( true ) ;
636
636
} ) ) ;
637
+
638
+ it ( "should apply all transition shorthand properties that are already on the element" ,
639
+ inject ( function ( $animateCss , $rootElement ) {
640
+
641
+ ss . addRule ( '.action' , 'transition: color 1s cubic-bezier(0.25, 0.1, 0.25, 1) 5s;' ) ;
642
+ element . addClass ( 'action' ) ;
643
+
644
+ var options = {
645
+ to : { background : 'blue' }
646
+ } ;
647
+
648
+ var animator = $animateCss ( element , options ) ;
649
+ animator . start ( ) ;
650
+ triggerAnimationStartFrame ( ) ;
651
+
652
+ expect ( element . css ( 'transition-duration' ) ) . toMatch ( '1s' ) ;
653
+ expect ( element . css ( 'transition-delay' ) ) . toMatch ( '5s' ) ;
654
+ expect ( element . css ( 'transition-property' ) ) . toMatch ( 'color' ) ;
655
+ expect ( element . css ( 'transition-timing-function' ) ) . toBe ( 'cubic-bezier(0.25, 0.1, 0.25, 1)' ) ;
656
+ } ) ) ;
657
+
658
+ it ( "should apply all explicit transition properties that are already on the element" ,
659
+ inject ( function ( $animateCss , $rootElement ) {
660
+
661
+ ss . addRule ( '.action' , 'transition-duration: 1s;' +
662
+ 'transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);' +
663
+ 'transition-property: color;' +
664
+ 'transition-delay: 5s' ) ;
665
+ element . addClass ( 'action' ) ;
666
+
667
+ var options = {
668
+ to : { background : 'blue' }
669
+ } ;
670
+
671
+ var animator = $animateCss ( element , options ) ;
672
+ animator . start ( ) ;
673
+ triggerAnimationStartFrame ( ) ;
674
+
675
+ expect ( element . css ( 'transition-duration' ) ) . toMatch ( '1s' ) ;
676
+ expect ( element . css ( 'transition-delay' ) ) . toMatch ( '5s' ) ;
677
+ expect ( element . css ( 'transition-property' ) ) . toMatch ( 'color' ) ;
678
+ expect ( element . css ( 'transition-timing-function' ) ) . toBe ( 'cubic-bezier(0.25, 0.1, 0.25, 1)' ) ;
679
+ } ) ) ;
680
+
681
+ it ( "should use the default transition-property (spec: all) if none is supplied in shorthand" ,
682
+ inject ( function ( $animateCss , $rootElement ) {
683
+
684
+ ss . addRule ( '.action' , 'transition: 1s ease' ) ;
685
+ element . addClass ( 'action' ) ;
686
+
687
+ var options = {
688
+ to : { background : 'blue' }
689
+ } ;
690
+
691
+ var animator = $animateCss ( element , options ) ;
692
+ animator . start ( ) ;
693
+ triggerAnimationStartFrame ( ) ;
694
+
695
+ expect ( element . css ( 'transition-property' ) ) . toBe ( 'all' ) ;
696
+ } ) ) ;
697
+
698
+ it ( "should use the default easing (spec: ease) if none is supplied in shorthand" ,
699
+ inject ( function ( $animateCss , $rootElement ) {
700
+
701
+ ss . addRule ( '.action' , 'transition: color 1s' ) ;
702
+ element . addClass ( 'action' ) ;
703
+
704
+ var options = {
705
+ to : { background : 'blue' }
706
+ } ;
707
+
708
+ var animator = $animateCss ( element , options ) ;
709
+ animator . start ( ) ;
710
+ triggerAnimationStartFrame ( ) ;
711
+
712
+ // IE reports ease in cubic-bezier form
713
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'ease' , 'cubic-bezier(0.25, 0.1, 0.25, 1)' ) ;
714
+ } ) ) ;
715
+
716
+
637
717
} ) ;
638
718
639
719
describe ( "staggering" , function ( ) {
@@ -2052,7 +2132,7 @@ describe("ngAnimate $animateCss", function() {
2052
2132
2053
2133
var style = element . attr ( 'style' ) ;
2054
2134
expect ( style ) . toContain ( '3000s' ) ;
2055
- expect ( style ) . toContain ( 'linear ') ;
2135
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'ease' , 'cubic-bezier(0.25, 0.1, 0.25, 1) ') ;
2056
2136
} ) ) ;
2057
2137
2058
2138
it ( "should be applied to a CSS keyframe animation directly if keyframes are detected within the CSS class" ,
@@ -2158,7 +2238,7 @@ describe("ngAnimate $animateCss", function() {
2158
2238
expect ( style ) . toMatch ( / a n i m a t i o n (?: - d u r a t i o n ) ? : \s * 4 s / ) ;
2159
2239
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '4s' ) ;
2160
2240
expect ( element . css ( 'transition-property' ) ) . toMatch ( 'all' ) ;
2161
- expect ( style ) . toContain ( 'linear' ) ;
2241
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'linear' , 'cubic-bezier(0, 0, 1, 1) ') ;
2162
2242
} ) ) ;
2163
2243
} ) ;
2164
2244
@@ -2322,7 +2402,7 @@ describe("ngAnimate $animateCss", function() {
2322
2402
var animator = $animateCss ( element , options ) ;
2323
2403
2324
2404
expect ( element . attr ( 'style' ) || '' ) . not . toContain ( 'animation-delay' ) ;
2325
- expect ( element . attr ( 'style' ) || '' ) . not . toContain ( 'transition-delay ') ;
2405
+ expect ( element . css ( 'transition-delay' ) ) . toEqual ( '-2s ') ;
2326
2406
expect ( classSpy ) . not . toHaveBeenCalled ( ) ;
2327
2407
2328
2408
//redefine the classSpy to assert that the delay values have been
@@ -2500,10 +2580,9 @@ describe("ngAnimate $animateCss", function() {
2500
2580
animator . start ( ) ;
2501
2581
triggerAnimationStartFrame ( ) ;
2502
2582
2503
- var style = element . attr ( 'style' ) ;
2504
2583
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '4s' ) ;
2505
2584
expect ( element . css ( 'transition-property' ) ) . toMatch ( 'color' ) ;
2506
- expect ( style ) . toContain ( 'ease-in' ) ;
2585
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'ease-in' , 'cubic-bezier(0.42, 0, 1, 1) ') ;
2507
2586
} ) ) ;
2508
2587
2509
2588
it ( "should give priority to the provided delay value, but only update the delay style itself" ,
@@ -2754,11 +2833,9 @@ describe("ngAnimate $animateCss", function() {
2754
2833
animator . start ( ) ;
2755
2834
triggerAnimationStartFrame ( ) ;
2756
2835
2757
-
2758
- var style = element . attr ( 'style' ) ;
2759
2836
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '2.5s' ) ;
2760
2837
expect ( element . css ( 'transition-property' ) ) . toMatch ( 'all' ) ;
2761
- expect ( style ) . toContain ( 'linear ') ;
2838
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'ease' , 'cubic-bezier(0.25, 0.1, 0.25, 1) ') ;
2762
2839
} ) ) ;
2763
2840
2764
2841
it ( "should remove all inline transition styling when an animation completes" ,
@@ -2889,7 +2966,7 @@ describe("ngAnimate $animateCss", function() {
2889
2966
it ( "should apply a transition duration if the existing transition duration's property value is not 'all'" ,
2890
2967
inject ( function ( $animateCss , $rootElement ) {
2891
2968
2892
- ss . addRule ( '.ng-enter' , 'transition: 1s linear color' ) ;
2969
+ ss . addRule ( '.ng-enter' , 'transition: 1s cubic-bezier(0.25, 0.1, 0.25, 1) color' ) ;
2893
2970
2894
2971
var emptyObject = { } ;
2895
2972
var options = {
@@ -2903,10 +2980,9 @@ describe("ngAnimate $animateCss", function() {
2903
2980
triggerAnimationStartFrame ( ) ;
2904
2981
2905
2982
2906
- var style = element . attr ( 'style' ) ;
2907
2983
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '1s' ) ;
2908
- expect ( element . css ( 'transition-property' ) ) . toMatch ( 'all ' ) ;
2909
- expect ( style ) . toContain ( 'linear ') ;
2984
+ expect ( element . css ( 'transition-property' ) ) . toMatch ( 'color ' ) ;
2985
+ expect ( element . css ( 'transition-timing-function' ) ) . toBe ( 'cubic-bezier(0.25, 0.1, 0.25, 1) ') ;
2910
2986
} ) ) ;
2911
2987
2912
2988
it ( "should apply a transition duration and an animation duration if duration + styles options are provided for a matching keyframe animation" ,
0 commit comments