aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngAnimate
diff options
context:
space:
mode:
authorMatias Niemelä2013-12-04 12:49:02 -0500
committerMatias Niemelä2013-12-05 10:54:19 -0500
commit958d3d56b1899a2cfc7b18c0292e5a1d8c64d0a5 (patch)
tree57dd8e7a093390ee3b6e030bc0cfe460d0b827e2 /test/ngAnimate
parent0e50810c53428f4c1f5bfdba9599df54cb7a6c6e (diff)
downloadangular.js-958d3d56b1899a2cfc7b18c0292e5a1d8c64d0a5.tar.bz2
fix($animate): ensure animations work with directives that share a transclusion
Closes #4716 Closes #4871 Closes #5021 Closes #5278
Diffstat (limited to 'test/ngAnimate')
-rw-r--r--test/ngAnimate/animateSpec.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index b3068470..44b623b4 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -2873,5 +2873,58 @@ describe("ngAnimate", function() {
expect($rootElement.children().length).toBe(0);
}));
+
+ it('should properly animate elements with compound directives', function() {
+ var capturedAnimation;
+ module(function($animateProvider) {
+ $animateProvider.register('.special', function() {
+ return {
+ enter : function(element, done) {
+ capturedAnimation = 'enter';
+ done();
+ },
+ leave : function(element, done) {
+ capturedAnimation = 'leave';
+ done();
+ }
+ }
+ });
+ });
+ inject(function($rootScope, $compile, $rootElement, $document, $timeout, $templateCache, $sniffer) {
+ if(!$sniffer.transitions) return;
+
+ $templateCache.put('item-template', 'item: #{{ item }} ');
+ var element = $compile('<div>' +
+ ' <div ng-repeat="item in items"' +
+ ' ng-include="tpl"' +
+ ' class="special"></div>' +
+ '</div>')($rootScope);
+
+ ss.addRule('.special', '-webkit-transition:1s linear all;' +
+ 'transition:1s linear all;');
+
+ $rootElement.append(element);
+ jqLite($document[0].body).append($rootElement);
+
+ $rootScope.tpl = 'item-template';
+ $rootScope.items = [1,2,3];
+ $rootScope.$digest();
+ $timeout.flush();
+
+ expect(capturedAnimation).toBe('enter');
+ expect(element.text()).toContain('item: #1');
+
+ forEach(element.children(), function(kid) {
+ browserTrigger(kid, 'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
+ });
+ $timeout.flush();
+
+ $rootScope.items = [];
+ $rootScope.$digest();
+ $timeout.flush();
+
+ expect(capturedAnimation).toBe('leave');
+ });
+ });
});
});