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

Commit

Permalink
fix($animate): ensure no transitions are applied when an empty inline…
Browse files Browse the repository at this point in the history
… style object is provided

Closes #10613
Closes #10770
  • Loading branch information
matsko authored and petebacondarwin committed Jan 19, 2015
1 parent 7fab29f commit 9b8df52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ngAnimate/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ angular.module('ngAnimate', ['ng'])
return;
}

if (!staggerTime && styles) {
if (!staggerTime && styles && Object.keys(styles).length > 0) {
if (!timings.transitionDuration) {
element.css('transition', timings.animationDuration + 's linear all');
appliedStyles.push('transition');
Expand Down
19 changes: 19 additions & 0 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,25 @@ describe("ngAnimate", function() {
expect(element.attr('style')).toContain('border-color: blue');
}));

it("should not apply a piggy-back-transition if the styles object contains no styles",
inject(function($compile, $animate, $rootScope, $sniffer) {

if (!$sniffer.animations) return;

$animate.enabled(true);
ss.addRule('.on', '-webkit-animation: 1s super-animation; animation: 1s super-animation;');

element = $compile(html('<div>1</div>'))($rootScope);

$animate.addClass(element, 'on', {
to: {}
});

$rootScope.$digest();
$animate.triggerReflow();
expect(element.attr('style')).not.toMatch(/transition/);
}));

it("should pause the playstate when performing a stagger animation",
inject(function($animate, $rootScope, $compile, $sniffer, $timeout) {

Expand Down

0 comments on commit 9b8df52

Please sign in to comment.