diff options
| author | Matias Niemelä | 2014-02-14 00:53:49 -0500 |
|---|---|---|
| committer | Igor Minar | 2014-02-14 16:28:56 -0800 |
| commit | cf5e463abd2c23f62e9c2e6361e6c53048c8910e (patch) | |
| tree | 1833c0e402b67b2bb5298fa0db91f8329eafc1fe /test | |
| parent | f288b8f010468237d238acf51ea3d8108138207a (diff) | |
| download | angular.js-cf5e463abd2c23f62e9c2e6361e6c53048c8910e.tar.bz2 | |
pref($animate): only trigger DOM callbacks if registered on the element being animated
BREAKING CHANGE: Both the `$animate:before` and `$animate:after` DOM events must be now
registered prior to the $animate operation taking place. The `$animate:close` event
can be registered anytime afterwards.
DOM callbacks used to fired for each and every animation operation that occurs within the
$animate service provided in the ngAnimate module. This may end up slowing down an
application if 100s of elements are being inserted into the page. Therefore after this
change callbacks are only fired if registered on the element being animated.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ngAnimate/animateSpec.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index 41115e42..8da3d1cb 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -1573,6 +1573,21 @@ describe("ngAnimate", function() { expect(steps.shift()).toEqual(['after', 'ng-enter', 'enter']); })); + it('should not fire DOM callbacks on the element being animated unless registered', + inject(function($animate, $rootScope, $compile, $sniffer, $rootElement, $timeout) { + + $animate.enabled(true); + + var element = jqLite('<div></div>'); + $rootElement.append(element); + body.append($rootElement); + + $animate.addClass(element, 'class'); + $rootScope.$digest(); + + $timeout.verifyNoPendingTasks(); + })); + it("should fire a done callback when provided with no animation", inject(function($animate, $rootScope, $compile, $sniffer, $rootElement, $timeout) { |
