diff options
| author | Matias Niemelä | 2014-01-22 19:21:05 -0500 |
|---|---|---|
| committer | Matias Niemelä | 2014-02-06 01:21:41 -0500 |
| commit | 906fdad0f95465842e336e057ea97d0633712189 (patch) | |
| tree | 0993034fe2ce43ad090203c7d2390662536d1d91 /test/ng/directive/ngIfSpec.js | |
| parent | a8c1d9c97804f7df98150456c2702fd39e3a22f0 (diff) | |
| download | angular.js-906fdad0f95465842e336e057ea97d0633712189.tar.bz2 | |
fix(mocks): remove usage of $animate.flushNext in favour of queing
The flushNext method of testing is difficult and highly coupled with the behavior
of ngAnimate's $animate workflow. It is much better instead to just queue all
$animate animation calls into a queue collection which is available on the $animate
service when mock.animate is included as a module within test code.
Diffstat (limited to 'test/ng/directive/ngIfSpec.js')
| -rwxr-xr-x | test/ng/directive/ngIfSpec.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/ng/directive/ngIfSpec.js b/test/ng/directive/ngIfSpec.js index db923150..81b54123 100755 --- a/test/ng/directive/ngIfSpec.js +++ b/test/ng/directive/ngIfSpec.js @@ -245,8 +245,9 @@ describe('ngIf animations', function () { $rootScope.$digest(); $scope.$apply('value = true'); - item = $animate.flushNext('enter').element; - expect(item.text()).toBe('Hi'); + item = $animate.queue.shift(); + expect(item.event).toBe('enter'); + expect(item.element.text()).toBe('Hi'); expect(element.children().length).toBe(1); })); @@ -262,14 +263,16 @@ describe('ngIf animations', function () { ))($scope); $scope.$apply('value = true'); - item = $animate.flushNext('enter').element; - expect(item.text()).toBe('Hi'); + item = $animate.queue.shift(); + expect(item.event).toBe('enter'); + expect(item.element.text()).toBe('Hi'); - $scope.$apply('value = false'); expect(element.children().length).toBe(1); + $scope.$apply('value = false'); - item = $animate.flushNext('leave').element; - expect(item.text()).toBe('Hi'); + item = $animate.queue.shift(); + expect(item.event).toBe('leave'); + expect(item.element.text()).toBe('Hi'); expect(element.children().length).toBe(0); })); |
