Skip to content

Commit

Permalink
fix($animate): make .pin() work with nested elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Narretz committed Dec 8, 2015
1 parent 458db13 commit 4051a03
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 4051a03

Please sign in to comment.