diff options
| author | Tomer Chachamu | 2014-03-04 15:29:11 +0000 |
|---|---|---|
| committer | Matias Niemelä | 2014-03-14 12:40:40 -0400 |
| commit | 129e2e021ab1d773874428cd1fb329eae72797c4 (patch) | |
| tree | 3c4d6640698d27032423df5a9535205f434c4be7 /test/ngAnimate/animateSpec.js | |
| parent | 3cc02e7f03787a9f41e493f3ca539190946933b0 (diff) | |
| download | angular.js-129e2e021ab1d773874428cd1fb329eae72797c4.tar.bz2 | |
fix(ngAnimate): setting classNameFilter disables animation inside ng-if
Closes #6539
Diffstat (limited to 'test/ngAnimate/animateSpec.js')
| -rw-r--r-- | test/ngAnimate/animateSpec.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index fb9ba19e..204ca9c3 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -3356,6 +3356,49 @@ describe("ngAnimate", function() { }); }); + it('should animate only the specified CSS className inside ng-if', function() { + var captures = {}; + module(function($animateProvider) { + $animateProvider.classNameFilter(/prefixed-animation/); + $animateProvider.register('.capture', function() { + return { + enter : buildFn('enter'), + leave : buildFn('leave') + }; + + function buildFn(key) { + return function(element, className, done) { + captures[key] = true; + (done || className)(); + } + } + }); + }); + inject(function($rootScope, $compile, $rootElement, $document, $sniffer, $animate) { + if(!$sniffer.transitions) return; + + var upperElement = $compile('<div><div ng-if=1><span class="capture prefixed-animation"></span></div></div>')($rootScope); + $rootElement.append(upperElement); + jqLite($document[0].body).append($rootElement); + + $rootScope.$digest(); + $animate.triggerCallbacks(); + + var element = upperElement.find('span'); + + var leaveDone = false; + $animate.leave(element, function() { + leaveDone = true; + }); + + $rootScope.$digest(); + $animate.triggerCallbacks(); + + expect(captures['leave']).toBe(true); + expect(leaveDone).toBe(true); + }); + }); + it('should respect the most relevant CSS transition property if defined in multiple classes', inject(function($sniffer, $compile, $rootScope, $rootElement, $animate, $timeout) { |
