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

Commit

Permalink
fix($animate): make .pin() work with nested elements
Browse files Browse the repository at this point in the history
Related #12617
  • Loading branch information
Narretz committed Dec 8, 2015
1 parent cd75312 commit 6d65fc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/ngAnimate/animateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
parentHost = parentElement.data(NG_ANIMATE_PIN_DATA);
if (parentHost) {
parentElement = parentHost;
rootElementDetected = true;
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1432,20 +1432,22 @@ describe("animations", function() {
jqLite($document[0].body).append(innerParent);
innerParent.append($rootElement);

var element = jqLite('<div></div>');
jqLite($document[0].body).append(element);
var pinElement = jqLite('<div><p></p></div>');
jqLite($document[0].body).append(pinElement);

$animate.addClass(element, 'red');
var animateElement = pinElement.find('p');

$animate.addClass(animateElement, 'red');
$rootScope.$digest();
expect(capturedAnimation).toBeFalsy();

$animate.pin(element, $rootElement);
$animate.pin(pinElement, $rootElement);

$animate.addClass(element, 'blue');
$animate.addClass(animateElement, 'blue');
$rootScope.$digest();
expect(capturedAnimation).toBeTruthy();

dealoc(element);
dealoc(pinElement);
}));

it('should adhere to the disabled state of the hosted parent when an element is pinned',
Expand Down

0 comments on commit 6d65fc3

Please sign in to comment.