@@ -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 ( ) {
@@ -1855,7 +1935,7 @@ describe("ngAnimate $animateCss", function() {
1855
1935
1856
1936
var style = element . attr ( 'style' ) ;
1857
1937
expect ( style ) . toContain ( '3000s' ) ;
1858
- expect ( style ) . toContain ( 'linear ') ;
1938
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'ease' , 'cubic-bezier(0.25, 0.1, 0.25, 1) ') ;
1859
1939
} ) ) ;
1860
1940
1861
1941
it ( "should be applied to a CSS keyframe animation directly if keyframes are detected within the CSS class" ,
@@ -1961,7 +2041,7 @@ describe("ngAnimate $animateCss", function() {
1961
2041
expect ( style ) . toMatch ( / a n i m a t i o n (?: - d u r a t i o n ) ? : \s * 4 s / ) ;
1962
2042
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '4s' ) ;
1963
2043
expect ( element . css ( 'transition-property' ) ) . toMatch ( 'all' ) ;
1964
- expect ( style ) . toContain ( 'linear' ) ;
2044
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'linear' , 'cubic-bezier(0, 0, 1, 1) ') ;
1965
2045
} ) ) ;
1966
2046
} ) ;
1967
2047
@@ -2125,7 +2205,7 @@ describe("ngAnimate $animateCss", function() {
2125
2205
var animator = $animateCss ( element , options ) ;
2126
2206
2127
2207
expect ( element . attr ( 'style' ) || '' ) . not . toContain ( 'animation-delay' ) ;
2128
- expect ( element . attr ( 'style' ) || '' ) . not . toContain ( 'transition-delay ') ;
2208
+ expect ( element . css ( 'transition-delay' ) ) . toEqual ( '-2s ') ;
2129
2209
expect ( classSpy ) . not . toHaveBeenCalled ( ) ;
2130
2210
2131
2211
//redefine the classSpy to assert that the delay values have been
@@ -2303,10 +2383,9 @@ describe("ngAnimate $animateCss", function() {
2303
2383
animator . start ( ) ;
2304
2384
triggerAnimationStartFrame ( ) ;
2305
2385
2306
- var style = element . attr ( 'style' ) ;
2307
2386
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '4s' ) ;
2308
2387
expect ( element . css ( 'transition-property' ) ) . toMatch ( 'color' ) ;
2309
- expect ( style ) . toContain ( 'ease-in' ) ;
2388
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'ease-in' , 'cubic-bezier(0.42, 0, 1, 1) ') ;
2310
2389
} ) ) ;
2311
2390
2312
2391
it ( "should give priority to the provided delay value, but only update the delay style itself" ,
@@ -2557,11 +2636,9 @@ describe("ngAnimate $animateCss", function() {
2557
2636
animator . start ( ) ;
2558
2637
triggerAnimationStartFrame ( ) ;
2559
2638
2560
-
2561
- var style = element . attr ( 'style' ) ;
2562
2639
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '2.5s' ) ;
2563
2640
expect ( element . css ( 'transition-property' ) ) . toMatch ( 'all' ) ;
2564
- expect ( style ) . toContain ( 'linear ') ;
2641
+ expect ( element . css ( 'transition-timing-function' ) ) . toBeOneOf ( 'ease' , 'cubic-bezier(0.25, 0.1, 0.25, 1) ') ;
2565
2642
} ) ) ;
2566
2643
2567
2644
it ( "should remove all inline transition styling when an animation completes" ,
@@ -2692,7 +2769,7 @@ describe("ngAnimate $animateCss", function() {
2692
2769
it ( "should apply a transition duration if the existing transition duration's property value is not 'all'" ,
2693
2770
inject ( function ( $animateCss , $rootElement ) {
2694
2771
2695
- ss . addRule ( '.ng-enter' , 'transition: 1s linear color' ) ;
2772
+ ss . addRule ( '.ng-enter' , 'transition: 1s cubic-bezier(0.25, 0.1, 0.25, 1) color' ) ;
2696
2773
2697
2774
var emptyObject = { } ;
2698
2775
var options = {
@@ -2706,10 +2783,9 @@ describe("ngAnimate $animateCss", function() {
2706
2783
triggerAnimationStartFrame ( ) ;
2707
2784
2708
2785
2709
- var style = element . attr ( 'style' ) ;
2710
2786
expect ( element . css ( 'transition-duration' ) ) . toMatch ( '1s' ) ;
2711
- expect ( element . css ( 'transition-property' ) ) . toMatch ( 'all ' ) ;
2712
- expect ( style ) . toContain ( 'linear ') ;
2787
+ expect ( element . css ( 'transition-property' ) ) . toMatch ( 'color ' ) ;
2788
+ expect ( element . css ( 'transition-timing-function' ) ) . toBe ( 'cubic-bezier(0.25, 0.1, 0.25, 1) ') ;
2713
2789
} ) ) ;
2714
2790
2715
2791
it ( "should apply a transition duration and an animation duration if duration + styles options are provided for a matching keyframe animation" ,
0 commit comments