From 36ad40b18cfdd0690411a5169aa94e222946b5cf Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Wed, 28 Aug 2013 19:32:20 -0400 Subject: fix(ngAnimate): ensure that ngClass is always compiled before enter, leave and move animations Closes #3727 Closes #3603 --- test/ngAnimate/animateSpec.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/ngAnimate') diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index 3aab3fec..661cc91e 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -133,6 +133,7 @@ describe("ngAnimate", function() { expect(element.contents().length).toBe(0); $animate.enter(child, element); + $rootScope.$digest(); if($sniffer.transitions) { expect(child.hasClass('ng-enter')).toBe(true); @@ -148,6 +149,8 @@ describe("ngAnimate", function() { expect(element.contents().length).toBe(1); $animate.leave(child); + $rootScope.$digest(); + if($sniffer.transitions) { expect(child.hasClass('ng-leave')).toBe(true); expect(child.hasClass('ng-leave-active')).toBe(true); @@ -169,6 +172,7 @@ describe("ngAnimate", function() { element.append(child2); expect(element.text()).toBe('12'); $animate.move(child1, element, child2); + $rootScope.$digest(); expect(element.text()).toBe('21'); })); @@ -213,6 +217,8 @@ describe("ngAnimate", function() { //enter $animate.enter(child, element); + $rootScope.$digest(); + expect(child.attr('class')).toContain('ng-enter'); expect(child.attr('class')).toContain('ng-enter-active'); $timeout.flushNext(1000); @@ -220,6 +226,8 @@ describe("ngAnimate", function() { //move element.append(after); $animate.move(child, element, after); + $rootScope.$digest(); + expect(child.attr('class')).toContain('ng-move'); expect(child.attr('class')).toContain('ng-move-active'); $timeout.flushNext(1000); @@ -238,6 +246,7 @@ describe("ngAnimate", function() { //leave $animate.leave(child); + $rootScope.$digest(); expect(child.attr('class')).toContain('ng-leave'); expect(child.attr('class')).toContain('ng-leave-active'); $timeout.flushNext(1000); @@ -274,6 +283,7 @@ describe("ngAnimate", function() { expect(child).toBeShown(); $animate.leave(child); + $rootScope.$digest(); expect(child).toBeHidden(); //hides instantly //lets change this to prove that done doesn't fire anymore for the previous hide() operation @@ -682,6 +692,7 @@ describe("ngAnimate", function() { element[0].className = 'abc'; $animate.enter(element, parent); + $rootScope.$digest(); if ($sniffer.transitions) { expect(element.hasClass('abc ng-enter')).toBe(true); @@ -692,6 +703,7 @@ describe("ngAnimate", function() { element[0].className = 'xyz'; $animate.enter(element, parent); + $rootScope.$digest(); if ($sniffer.transitions) { expect(element.hasClass('xyz')).toBe(true); @@ -717,6 +729,7 @@ describe("ngAnimate", function() { element.attr('class','one two'); $animate.enter(element, parent); + $rootScope.$digest(); if($sniffer.transitions) { expect(element.hasClass('one two ng-enter')).toBe(true); expect(element.hasClass('one two ng-enter ng-enter-active')).toBe(true); @@ -766,6 +779,7 @@ describe("ngAnimate", function() { $animate.enter(element, parent, null, function() { flag = true; }); + $rootScope.$digest(); $timeout.flush(); @@ -784,6 +798,7 @@ describe("ngAnimate", function() { $animate.leave(element, function() { flag = true; }); + $rootScope.$digest(); $timeout.flush(); @@ -803,6 +818,7 @@ describe("ngAnimate", function() { $animate.move(element, parent, parent2, function() { flag = true; }); + $rootScope.$digest(); $timeout.flush(); @@ -1212,6 +1228,7 @@ describe("ngAnimate", function() { var child = $compile('