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

fix($animate): make sure the JS animation lookup is an object lookup #11640

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/ng/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ var $$CoreAnimateQueueProvider = function() {
var $AnimateProvider = ['$provide', function($provide) {
var provider = this;

this.$$registeredAnimations = [];
this.$$registeredAnimations = Object.create(null);

/**
* @ngdoc method
Expand Down
15 changes: 15 additions & 0 deletions test/ng/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ describe("$animate", function() {
inject();
});

it("should register the animation and be available for lookup", function() {
var provider;
module(function($animateProvider) {
provider = $animateProvider;
});
inject(function() {
// by using hasOwnProperty we know for sure that the lookup object is an empty object
// instead of inhertiting properties from its original prototype.
expect(provider.$$registeredAnimations.hasOwnProperty).toBeFalsy();

provider.register('.filter', noop);
expect(provider.$$registeredAnimations['filter']).toBe('.filter-animation');
});
});

it("should apply and retain inline styles on the element that is animated", inject(function($animate, $rootScope) {
var element = jqLite('<div></div>');
var parent = jqLite('<div></div>');
Expand Down