diff options
| author | Matias Niemelä | 2014-02-13 14:59:25 -0500 | 
|---|---|---|
| committer | Igor Minar | 2014-02-14 16:28:34 -0800 | 
| commit | f288b8f010468237d238acf51ea3d8108138207a (patch) | |
| tree | e60cde5cfc2c64f4b54fd76c3ad05e77cf7c9806 /test/ngAnimate/animateSpec.js | |
| parent | b7e4e92014a5fe7a2d8c896703498090d88793ce (diff) | |
| download | angular.js-f288b8f010468237d238acf51ea3d8108138207a.tar.bz2 | |
pref($animate): group all asynchronous requests into one shared buffer
Diffstat (limited to 'test/ngAnimate/animateSpec.js')
| -rw-r--r-- | test/ngAnimate/animateSpec.js | 39 | 
1 files changed, 31 insertions, 8 deletions
| diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index d626d60e..41115e42 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -2563,8 +2563,9 @@ describe("ngAnimate", function() {      }); -    it("should disable all child animations on structural animations until the post animation timeout has passed", function() { -      var intercepted; +    it("should disable all child animations on structural animations until the post animation" + +       "timeout has passed as well as all structural animations", function() { +      var intercepted, continueAnimation;        module(function($animateProvider) {          $animateProvider.register('.animated', function() {            return { @@ -2578,7 +2579,10 @@ describe("ngAnimate", function() {            function ani(type) {              return function(element, className, done) {                intercepted = type; -              (done || className)(); +              continueAnimation = function() { +                continueAnimation = angular.noop; +                (done || className)(); +              }              }            }          }); @@ -2595,26 +2599,45 @@ describe("ngAnimate", function() {          var child2 = $compile('<div class="child2 animated">...</div>')($rootScope);          var container = $compile('<div class="container">...</div>')($rootScope); -        jqLite($document[0].body).append($rootElement); +        var body = angular.element($document[0].body); +        body.append($rootElement);          $rootElement.append(container);          element.append(child1);          element.append(child2); -        $animate.move(element, null, container); +        $animate.enter(element, container);          $rootScope.$digest(); -        expect(intercepted).toBe('move'); +        expect(intercepted).toBe('enter'); +        continueAnimation();          $animate.addClass(child1, 'test');          expect(child1.hasClass('test')).toBe(true); -        expect(intercepted).toBe('move'); +        expect(element.children().length).toBe(2); + +        expect(intercepted).toBe('enter');          $animate.leave(child1);          $rootScope.$digest(); +        expect(element.children().length).toBe(1); + +        expect(intercepted).toBe('enter'); + +        $animate.move(element, null, container); +        $rootScope.$digest(); +          expect(intercepted).toBe('move'); -        //reflow has passed +        //flush the enter reflow +        $timeout.flush(); + +        $animate.addClass(child2, 'testing'); +        expect(intercepted).toBe('move'); + +        continueAnimation(); + +        //flush the move reflow          $timeout.flush();          $animate.leave(child2); | 
