8000 Fix options copy by Narretz · Pull Request #13722 · angular/angular.js · GitHub
[go: up one dir, main page]

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

Fix options copy #13722

Merged
merged 2 commits into from
Jan 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(ngMock): ignore empty javascript animations in $animate.closeAndF…
…lush()
  • Loading branch information
Narretz committed Jan 11, 2016
commit a801df719ea8b5996676d4e7a88a26a5ece471e7
5 changes: 4 additions & 1 deletion src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,10 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])

var animateJsConstructor = function() {
var animator = $delegate.apply($delegate, arguments);
runners.push(animator);
// If no javascript animation is found, animator is undefined
if (animator) {
runners.push(animator);
}
return animator;
};

Expand Down
22 changes: 22 additions & 0 deletions test/ngMock/angular-mocksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2230,12 +2230,34 @@ describe('ngMockE2E', function() {
expect(animationLog).toEqual(['start leave', 'end leave']);
}));

it('should not throw when a regular animation has no javascript animation',
inject(function($animate, $$animation, $rootElement) {

var element = jqLite('<div></div>');
$rootElement.append(element);

// Make sure the animation has valid $animateCss options
$$animation(element, null, {
from: { background: 'red' },
to: { background: 'blue' },
duration: 1,
transitionStyle: '1s linear all'
});

expect(function() {
$animate.closeAndFlush();
}).not.toThrow();

dealoc(element);
}));

it('should throw an error if there are no animations to close and flush',
inject(function($animate) {

expect(function() {
$animate.closeAndFlush();
}).toThrow('No pending animations ready to be closed or flushed');

}));
});
});
Expand Down
0