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

Commit 8a69ab0

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

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

test/ngAnimate/animateCssSpec.js

+10-16
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
});
@@ -1901,7 +1899,7 @@ describe("ngAnimate $animateCss", function() {
19011899

19021900
var style = element.attr('style');
19031901
expect(style).toContain('3000s');
1904-
expect(style).toContain('ease');
1902+
expect(element.css('transition-timing-function')).toBeOneOf('ease', 'cubic-bezier(0.25, 0.1, 0.25, 1)');
19051903
}));
19061904

19071905
it("should be applied to a CSS keyframe animation directly if keyframes are detected within the CSS class",
@@ -2007,7 +2005,7 @@ describe("ngAnimate $animateCss", function() {
20072005
expect(style).toMatch(/animation(?:-duration)?:\s*4s/);
20082006
expect(element.css('transition-duration')).toMatch('4s');
20092007
expect(element.css('transition-property')).toMatch('all');
2010-
expect(style).toContain('linear');
2008+
expect(element.css('transition-timing-function')).toBeOneOf('linear', 'cubic-bezier(0, 0, 1, 1)');
20112009
}));
20122010
});
20132011

@@ -2349,10 +2347,9 @@ describe("ngAnimate $animateCss", function() {
23492347
animator.start();
23502348
triggerAnimationStartFrame();
23512349

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

23582355
it("should give priority to the provided delay value, but only update the delay style itself",
@@ -2603,11 +2600,9 @@ describe("ngAnimate $animateCss", function() {
26032600
animator.start();
26042601
triggerAnimationStartFrame();
26052602

2606-
2607-
var style = element.attr('style');
26082603
expect(element.css('transition-duration')).toMatch('2.5s');
26092604
expect(element.css('transition-property')).toMatch('all');
2610-
expect(style).toContain('ease');
2605+
expect(element.css('transition-timing-function')).toBeOneOf('ease', 'cubic-bezier(0.25, 0.1, 0.25, 1)');
26112606
}));
26122607

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

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

27432738
var emptyObject = {};
27442739
var options = {
@@ -2752,10 +2747,9 @@ describe("ngAnimate $animateCss", function() {
27522747
triggerAnimationStartFrame();
27532748

27542749

2755-
var style = element.attr('style');
27562750
expect(element.css('transition-duration')).toMatch('1s');
27572751
expect(element.css('transition-property')).toMatch('color');
2758-
expect(style).toContain('linear');
2752+
expect(element.css('transition-timing-function')).toBe('cubic-bezier(0.25, 0.1, 0.25, 1)');
27592753
}));
27602754

27612755
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)