diff --git a/src/ngAnimate/animateQueue.js b/src/ngAnimate/animateQueue.js index 0d22adc35c40..c9af6632e647 100644 --- a/src/ngAnimate/animateQueue.js +++ b/src/ngAnimate/animateQueue.js @@ -586,6 +586,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) { parentHost = parentElement.data(NG_ANIMATE_PIN_DATA); if (parentHost) { parentElement = parentHost; + rootElementDetected = true; } } } diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index b0ff47701b2d..4b562e3ca7e0 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -1425,28 +1425,46 @@ describe("animations", function() { })); - it('should allow an element to be pinned elsewhere and still be available in animations', - inject(function($animate, $compile, $document, $rootElement, $rootScope) { + they('should animate an element inside a pinned element that is the $prop element', + ['same', 'parent', 'grandparent'], + function(elementRelation) { + inject(function($animate, $compile, $document, $rootElement, $rootScope) { - var innerParent = jqLite('
'); - jqLite($document[0].body).append(innerParent); - innerParent.append($rootElement); + var pinElement, animateElement; - var element = jqLite(''); - jqLite($document[0].body).append(element); + var innerParent = jqLite(''); + jqLite($document[0].body).append(innerParent); + innerParent.append($rootElement); - $animate.addClass(element, 'red'); - $rootScope.$digest(); - expect(capturedAnimation).toBeFalsy(); + switch (elementRelation) { + case 'same': + pinElement = jqLite(''); + break; + case 'parent': + pinElement = jqLite('