Skip to content

Commit dfe438a

Browse files
committed
fix($animateCss): consider options.delay value for closing timeout
Previously, options.delay was only considered when a class added an extra transition style (which leads to style recalculation). Fixes angular#13355
1 parent d9ec995 commit dfe438a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/ngAnimate/animateCss.js

+1
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
623623

624624
if (options.delay != null) {
625625
var delayStyle = parseFloat(options.delay);
626+
maxDelay = Math.max(options.delay, 0);
626627

627628
if (flags.applyTransitionDelay) {
628629
temporaryStyles.push(getCssDelayStyle(delayStyle));

test/ngAnimate/animateCssSpec.js

+25
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,31 @@ describe("ngAnimate $animateCss", function() {
19861986
expect(prop).toEqual('500s');
19871987
}));
19881988

1989+
it("should consider the delay for the closing timeout",
1990+
inject(function($animateCss, $rootElement, $timeout) {
1991+
1992+
element.css('height', '10px');
1993+
1994+
var options = {
1995+
delay: 3,
1996+
duration: 3,
1997+
to: {
1998+
height: '100px'
1999+
}
2000+
};
2001+
2002+
var animator = $animateCss(element, options);
2003+
2004+
animator.start();
2005+
triggerAnimationStartFrame();
2006+
2007+
expect(element.css(prefix + 'transition-delay')).toContain('3s');
2008+
2009+
$timeout.flush(5000);
2010+
2011+
expect(element.css(prefix + 'transition-delay')).toContain('3s');
2012+
}));
2013+
19892014
it("should return false for the animator if a delay is provided but not a duration",
19902015
inject(function($animateCss, $rootElement) {
19912016

0 commit comments

Comments
 (0)