Skip to content

Commit 4051a03

Browse files
committed
fix($animate): make .pin() work with nested elements
Related angular#12617
1 parent 458db13 commit 4051a03

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/ngAnimate/animateQueue.js

+1
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
586586
parentHost = parentElement.data(NG_ANIMATE_PIN_DATA);
587587
if (parentHost) {
588588
parentElement = parentHost;
589+
rootElementDetected = true;
589590
}
590591
}
591592
}

test/ngAnimate/animateSpec.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1432,20 +1432,22 @@ describe("animations", function() {
14321432
jqLite($document[0].body).append(innerParent);
14331433
innerParent.append($rootElement);
14341434

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

1438-
$animate.addClass(element, 'red');
1438+
var animateElement = pinElement.find('p');
1439+
1440+
$animate.addClass(animateElement, 'red');
14391441
$rootScope.$digest();
14401442
expect(capturedAnimation).toBeFalsy();
14411443

1442-
$animate.pin(element, $rootElement);
1444+
$animate.pin(pinElement, $rootElement);
14431445

1444-
$animate.addClass(element, 'blue');
1446+
$animate.addClass(animateElement, 'blue');
14451447
$rootScope.$digest();
14461448
expect(capturedAnimation).toBeTruthy();
14471449

1448-
dealoc(element);
1450+
dealoc(pinElement);
14491451
}));
14501452

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

0 commit comments

Comments
 (0)