aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngAnimate
diff options
context:
space:
mode:
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');
+ });
+ });
});
});