Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 01fe1bc

Browse files
committed
test(): fix timing fn assertions for browser differences
1 parent 61527f3 commit 01fe1bc

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

test/ngAnimate/animateCssSpec.js

+10-17
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ describe("ngAnimate $animateCss", function() {
638638
it("should apply all transition shorthand properties that are already on the element",
639639
inject(function($animateCss, $rootElement) {
640640

641-
ss.addRule('.action', 'transition: color 1s ease-out 5s;');
641+
ss.addRule('.action', 'transition: color 1s cubic-bezier(0.25, 0.1, 0.25, 1) 5s;');
642642
element.addClass('action');
643643

644644
var options = {
@@ -649,18 +649,17 @@ describe("ngAnimate $animateCss", function() {
649649
animator.start();
650650
triggerAnimationStartFrame();
651651

652-
var style = element.attr('style');
653652
expect(element.css('transition-duration')).toMatch('1s');
654653
expect(element.css('transition-delay')).toMatch('5s');
655654
expect(element.css('transition-property')).toMatch('color');
656-
expect(style).toContain('ease-out');
655+
expect(element.css('transition-timing-function')).toBe('cubic-bezier(0.25, 0.1, 0.25, 1)');
657656
}));
658657

659658
it("should apply all explicit transition properties that are already on the element",
660659
inject(function($animateCss, $rootElement) {
661660

662661
ss.addRule('.action', 'transition-duration: 1s;' +
663-
'transition-timing-function: ease-out;' +
662+
'transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);' +
664663
'transition-property: color;' +
665664
'transition-delay: 5s');
666665
element.addClass('action');
@@ -673,11 +672,10 @@ describe("ngAnimate $animateCss", function() {
673672
animator.start();
674673
triggerAnimationStartFrame();
675674

676-
var style = element.attr('style');
677675
expect(element.css('transition-duration')).toMatch('1s');
678676
expect(element.css('transition-delay')).toMatch('5s');
679677
expect(element.css('transition-property')).toMatch('color');
680-
expect(style).toContain('ease-out');
678+
expect(element.css('transition-timing-function')).toBe('cubic-bezier(0.25, 0.1, 0.25, 1)');
681679
}));
682680

683681
});
@@ -1899,9 +1897,8 @@ describe("ngAnimate $animateCss", function() {
18991897
animator.start();
19001898
triggerAnimationStartFrame();
19011899

1902-
var style = element.attr('style');
19031900
expect(style).toContain('3000s');
1904-
expect(style).toContain('ease');
1901+
expect(element.css('transition-timing-function')).toBeOneOf('ease', 'cubic-bezier(0.25, 0.1, 0.25, 1)');
19051902
}));
19061903

19071904
it("should be applied to a CSS keyframe animation directly if keyframes are detected within the CSS class",
@@ -2007,7 +2004,7 @@ describe("ngAnimate $animateCss", function() {
20072004
expect(style).toMatch(/animation(?:-duration)?:\s*4s/);
20082005
expect(element.css('transition-duration')).toMatch('4s');
20092006
expect(element.css('transition-property')).toMatch('all');
2010-
expect(style).toContain('linear');
2007+
expect(element.css('transition-timing-function')).toBeOneOf('linear', 'cubic-bezier(0, 0, 1, 1)');
20112008
}));
20122009
});
20132010

@@ -2349,10 +2346,9 @@ describe("ngAnimate $animateCss", function() {
23492346
animator.start();
23502347
triggerAnimationStartFrame();
23512348

2352-
var style = element.attr('style');
23532349
expect(element.css('transition-duration')).toMatch('4s');
23542350
expect(element.css('transition-property')).toMatch('color');
2355-
expect(style).toContain('ease-in');
2351+
expect(element.css('transition-timing-function')).toBeOneOf('ease-in', 'cubic-bezier(0.42, 0, 1, 1)');
23562352
}));
23572353

23582354
it("should give priority to the provided delay value, but only update the delay style itself",
@@ -2603,11 +2599,9 @@ describe("ngAnimate $animateCss", function() {
26032599
animator.start();
26042600
triggerAnimationStartFrame();
26052601

2606-
2607-
var style = element.attr('style');
26082602
expect(element.css('transition-duration')).toMatch('2.5s');
26092603
expect(element.css('transition-property')).toMatch('all');
2610-
expect(style).toContain('ease');
2604+
expect(element.css('transition-timing-function')).toBeOneOf('ease', 'cubic-bezier(0.25, 0.1, 0.25, 1)');
26112605
}));
26122606

26132607
it("should remove all inline transition styling when an animation completes",
@@ -2738,7 +2732,7 @@ describe("ngAnimate $animateCss", function() {
27382732
it("should apply a transition duration if the existing transition duration's property value is not 'all'",
27392733
inject(function($animateCss, $rootElement) {
27402734

2741-
ss.addRule('.ng-enter', 'transition: 1s linear color');
2735+
ss.addRule('.ng-enter', 'transition: 1s cubic-bezier(0.25, 0.1, 0.25, 1) color');
27422736

27432737
var emptyObject = {};
27442738
var options = {
@@ -2752,10 +2746,9 @@ describe("ngAnimate $animateCss", function() {
27522746
triggerAnimationStartFrame();
27532747

27542748

2755-
var style = element.attr('style');
27562749
expect(element.css('transition-duration')).toMatch('1s');
27572750
expect(element.css('transition-property')).toMatch('color');
2758-
expect(style).toContain('linear');
2751+
expect(element.css('transition-timing-function')).toBe('cubic-bezier(0.25, 0.1, 0.25, 1)');
27592752
}));
27602753

27612754
it("should apply a transition duration and an animation duration if duration + styles options are provided for a matching keyframe animation",

0 commit comments

Comments
 (0)