Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 85d705a

Browse files
matskomhevery
authored andcommitted
chore(ngMock): rename $animate.process to $animate.flushNext()
1 parent 52a7c35 commit 85d705a

File tree

8 files changed

+49
-49
lines changed

8 files changed

+49
-49
lines changed

src/ngMock/angular-mocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ angular.mock.animate = angular.module('mock.animate', ['ng'])
664664
var animate = {
665665
queue : [],
666666
enabled : $delegate.enabled,
667-
process : function(name) {
667+
flushNext : function(name) {
668668
var tick = animate.queue.shift();
669669
expect(tick.method).toBe(name);
670670
tick.fn();

test/ng/directive/ngClassSpec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -322,27 +322,27 @@ describe('ngClass animations', function() {
322322

323323
$rootScope.val = 'one';
324324
$rootScope.$digest();
325-
$animate.process('addClass');
326-
$animate.process('addClass');
325+
$animate.flushNext('addClass');
326+
$animate.flushNext('addClass');
327327
$timeout.flush();
328328
expect($animate.queue.length).toBe(0);
329329

330330
$rootScope.val = '';
331331
$rootScope.$digest();
332-
$animate.process('removeClass'); //only removeClass is called
332+
$animate.flushNext('removeClass'); //only removeClass is called
333333
expect($animate.queue.length).toBe(0);
334334
$timeout.flush();
335335

336336
$rootScope.val = 'one';
337337
$rootScope.$digest();
338-
$animate.process('addClass');
338+
$animate.flushNext('addClass');
339339
$timeout.flush();
340340
expect($animate.queue.length).toBe(0);
341341

342342
$rootScope.val = 'two';
343343
$rootScope.$digest();
344-
$animate.process('removeClass');
345-
$animate.process('addClass');
344+
$animate.flushNext('removeClass');
345+
$animate.flushNext('addClass');
346346
$timeout.flush();
347347
expect($animate.queue.length).toBe(0);
348348
}));

test/ng/directive/ngIfSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('ngIf animations', function () {
119119
$rootScope.$digest();
120120
$scope.$apply('value = true');
121121

122-
item = $animate.process('enter').element;
122+
item = $animate.flushNext('enter').element;
123123
expect(item.text()).toBe('Hi');
124124

125125
expect(element.children().length).toBe(1);
@@ -136,13 +136,13 @@ describe('ngIf animations', function () {
136136
))($scope);
137137
$scope.$apply('value = true');
138138

139-
item = $animate.process('enter').element;
139+
item = $animate.flushNext('enter').element;
140140
expect(item.text()).toBe('Hi');
141141

142142
$scope.$apply('value = false');
143143
expect(element.children().length).toBe(1);
144144

145-
item = $animate.process('leave').element;
145+
item = $animate.flushNext('leave').element;
146146
expect(item.text()).toBe('Hi');
147147

148148
expect(element.children().length).toBe(0);

test/ng/directive/ngIncludeSpec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ describe('ngInclude animations', function() {
388388
))($rootScope);
389389
$rootScope.$digest();
390390

391-
item = $animate.process('enter').element;
391+
item = $animate.flushNext('enter').element;
392392
expect(item.text()).toBe('data');
393393
}));
394394

@@ -404,13 +404,13 @@ describe('ngInclude animations', function() {
404404
))($rootScope);
405405
$rootScope.$digest();
406406

407-
item = $animate.process('enter').element;
407+
item = $animate.flushNext('enter').element;
408408
expect(item.text()).toBe('data');
409409

410410
$rootScope.tpl = '';
411411
$rootScope.$digest();
412412

413-
item = $animate.process('leave').element;
413+
item = $animate.flushNext('leave').element;
414414
expect(item.text()).toBe('data');
415415
}));
416416

@@ -427,14 +427,14 @@ describe('ngInclude animations', function() {
427427
))($rootScope);
428428
$rootScope.$digest();
429429

430-
item = $animate.process('enter').element;
430+
item = $animate.flushNext('enter').element;
431431
expect(item.text()).toBe('one');
432432

433433
$rootScope.tpl = 'two';
434434
$rootScope.$digest();
435435

436-
var itemA = $animate.process('leave').element;
437-
var itemB = $animate.process('enter').element;
436+
var itemA = $animate.flushNext('leave').element;
437+
var itemB = $animate.flushNext('enter').element;
438438
expect(itemA.attr('ng-include')).toBe('tpl');
439439
expect(itemB.attr('ng-include')).toBe('tpl');
440440
expect(itemA).not.toEqual(itemB);

test/ng/directive/ngRepeatSpec.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -907,13 +907,13 @@ describe('ngRepeat animations', function() {
907907
$rootScope.items = ['1','2','3'];
908908
$rootScope.$digest();
909909

910-
item = $animate.process('enter').element;
910+
item = $animate.flushNext('enter').element;
911911
expect(item.text()).toBe('1');
912912

913-
item = $animate.process('enter').element;
913+
item = $animate.flushNext('enter').element;
914914
expect(item.text()).toBe('2');
915915

916-
item = $animate.process('enter').element;
916+
item = $animate.flushNext('enter').element;
917917
expect(item.text()).toBe('3');
918918
}));
919919

@@ -932,19 +932,19 @@ describe('ngRepeat animations', function() {
932932
$rootScope.items = ['1','2','3'];
933933
$rootScope.$digest();
934934

935-
item = $animate.process('enter').element;
935+
item = $animate.flushNext('enter').element;
936936
expect(item.text()).toBe('1');
937937

938-
item = $animate.process('enter').element;
938+
item = $animate.flushNext('enter').element;
939939
expect(item.text()).toBe('2');
940940

941-
item = $animate.process('enter').element;
941+
item = $animate.flushNext('enter').element;
942942
expect(item.text()).toBe('3');
943943

944944
$rootScope.items = ['1','3'];
945945
$rootScope.$digest();
946946

947-
item = $animate.process('leave').element;
947+
item = $animate.flushNext('leave').element;
948948
expect(item.text()).toBe('2');
949949
}));
950950

@@ -964,22 +964,22 @@ describe('ngRepeat animations', function() {
964964
$rootScope.items = ['1','2','3'];
965965
$rootScope.$digest();
966966

967-
item = $animate.process('enter').element;
967+
item = $animate.flushNext('enter').element;
968968
expect(item.text()).toBe('1');
969969

970-
item = $animate.process('enter').element;
970+
item = $animate.flushNext('enter').element;
971971
expect(item.text()).toBe('2');
972972

973-
item = $animate.process('enter').element;
973+
item = $animate.flushNext('enter').element;
974974
expect(item.text()).toBe('3');
975975

976976
$rootScope.items = ['2','3','1'];
977977
$rootScope.$digest();
978978

979-
item = $animate.process('move').element;
979+
item = $animate.flushNext('move').element;
980980
expect(item.text()).toBe('2');
981981

982-
item = $animate.process('move').element;
982+
item = $animate.flushNext('move').element;
983983
expect(item.text()).toBe('1');
984984
}));
985985

test/ng/directive/ngShowHideSpec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ describe('ngShow / ngHide animations', function() {
8181
))($scope);
8282
$scope.$digest();
8383

84-
item = $animate.process('removeClass').element;
84+
item = $animate.flushNext('removeClass').element;
8585
expect(item.text()).toBe('data');
8686
expect(item).toBeShown();
8787

8888
$scope.on = false;
8989
$scope.$digest();
9090

91-
item = $animate.process('addClass').element;
91+
item = $animate.flushNext('addClass').element;
9292
expect(item.text()).toBe('data');
9393
expect(item).toBeHidden();
9494
}));
@@ -104,14 +104,14 @@ describe('ngShow / ngHide animations', function() {
104104
))($scope);
105105
$scope.$digest();
106106

107-
item = $animate.process('addClass').element;
107+
item = $animate.flushNext('addClass').element;
108108
expect(item.text()).toBe('datum');
109109
expect(item).toBeHidden();
110110

111111
$scope.off = false;
112112
$scope.$digest();
113113

114-
item = $animate.process('removeClass').element;
114+
item = $animate.flushNext('removeClass').element;
115115
expect(item.text()).toBe('datum');
116116
expect(item).toBeShown();
117117
}));

test/ng/directive/ngSwitchSpec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ describe('ngSwitch animations', function() {
255255
$scope.val = 'one';
256256
$scope.$digest();
257257

258-
item = $animate.process('enter').element;
258+
item = $animate.flushNext('enter').element;
259259
expect(item.text()).toBe('one');
260260
}));
261261

@@ -276,16 +276,16 @@ describe('ngSwitch animations', function() {
276276
$scope.val = 'two';
277277
$scope.$digest();
278278

279-
item = $animate.process('enter').element;
279+
item = $animate.flushNext('enter').element;
280280
expect(item.text()).toBe('two');
281281

282282
$scope.val = 'three';
283283
$scope.$digest();
284284

285-
item = $animate.process('leave').element;
285+
item = $animate.flushNext('leave').element;
286286
expect(item.text()).toBe('two');
287287

288-
item = $animate.process('enter').element;
288+
item = $animate.flushNext('enter').element;
289289
expect(item.text()).toBe('three');
290290
}));
291291

test/ngRoute/directive/ngViewSpec.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ describe('ngView animations', function() {
556556
$location.path('/foo');
557557
$rootScope.$digest();
558558

559-
var item = $animate.process('enter').element;
559+
var item = $animate.flushNext('enter').element;
560560
expect(item.text()).toBe('data');
561561
}));
562562

@@ -570,13 +570,13 @@ describe('ngView animations', function() {
570570
$location.path('/foo');
571571
$rootScope.$digest();
572572

573-
item = $animate.process('enter').element;
573+
item = $animate.flushNext('enter').element;
574574
expect(item.text()).toBe('foo');
575575

576576
$location.path('/');
577577
$rootScope.$digest();
578578

579-
item = $animate.process('leave').element;
579+
item = $animate.flushNext('leave').element;
580580
expect(item.text()).toBe('foo');
581581
}));
582582

@@ -590,15 +590,15 @@ describe('ngView animations', function() {
590590
$location.path('/foo');
591591
$rootScope.$digest();
592592

593-
item = $animate.process('enter').element;
593+
item = $animate.flushNext('enter').element;
594594
expect(item.text()).toBe('data');
595595

596596
$location.path('/bar');
597597
$rootScope.$digest();
598598

599-
var itemA = $animate.process('leave').element;
599+
var itemA = $animate.flushNext('leave').element;
600600
expect(itemA).not.toEqual(itemB);
601-
var itemB = $animate.process('enter').element;
601+
var itemB = $animate.flushNext('enter').element;
602602
}));
603603
});
604604

@@ -627,12 +627,12 @@ describe('ngView animations', function() {
627627
$location.path('/foo');
628628
$rootScope.$digest();
629629

630-
$animate.process('enter'); //ngView
630+
$animate.flushNext('enter'); //ngView
631631

632632
$timeout.flush();
633633

634-
$animate.process('enter'); //repeat 1
635-
$animate.process('enter'); //repeat 2
634+
$animate.flushNext('enter'); //repeat 1
635+
$animate.flushNext('enter'); //repeat 2
636636

637637
$timeout.flush();
638638

@@ -641,16 +641,16 @@ describe('ngView animations', function() {
641641
$location.path('/bar');
642642
$rootScope.$digest();
643643

644-
$animate.process('leave'); //ngView old
644+
$animate.flushNext('leave'); //ngView old
645645
$timeout.flush();
646646

647-
$animate.process('enter'); //ngView new
647+
$animate.flushNext('enter'); //ngView new
648648
$timeout.flush();
649649

650650
expect(n(element.text())).toEqual(''); //this is midway during the animation
651651

652-
$animate.process('enter'); //ngRepeat 3
653-
$animate.process('enter'); //ngRepeat 4
652+
$animate.flushNext('enter'); //ngRepeat 3
653+
$animate.flushNext('enter'); //ngRepeat 4
654654

655655
$timeout.flush();
656656

0 commit comments

Comments
 (0)