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

Commit 8f819d2

Browse files
committed
fix($animate): ensure that from styles are applied for class-based animations
1 parent abf59c2 commit 8f819d2

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/ngAnimate/animateCss.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -699,9 +699,8 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
699699
stagger.animationDuration === 0;
700700
}
701701

702-
if (flags.blockTransition) {
703-
applyAnimationFromStyles(element, options);
704-
} else {
702+
applyAnimationFromStyles(element, options);
703+
if (!flags.blockTransition) {
705704
blockTransitions(node, false);
706705
}
707706

test/ngAnimate/animateCssSpec.js

+20
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,26 @@ describe("ngAnimate $animateCss", function() {
21162116
expect(element.css('height')).toBe('66px');
21172117
}));
21182118

2119+
it("should always apply the from styles before the start function is called even if no transition is detected when started",
2120+
inject(function($animateCss, $rootElement) {
2121+
2122+
ss.addRule('.my-class', 'transition: 0s linear color');
2123+
2124+
var options = {
2125+
addClass: 'my-class',
2126+
from: { height: '26px' },
2127+
to: { height: '500px' }
2128+
};
2129+
2130+
var animator = $animateCss(element, options);
2131+
expect(element.css('height')).toBe('26px');
2132+
2133+
animator.start();
2134+
triggerAnimationStartFrame();
2135+
2136+
expect(element.css('height')).toBe('500px');
2137+
}));
2138+
21192139
it("should apply an inline transition if [to] styles and a duration are provided",
21202140
inject(function($animateCss, $rootElement) {
21212141

0 commit comments

Comments
 (0)