chore(ngMock): rename $animate.process to $animate.flushNext()

This commit is contained in:
Matias Niemelä 2013-07-31 15:38:19 -04:00 committed by Misko Hevery
parent 52a7c351c9
commit 85d705ab69
8 changed files with 49 additions and 49 deletions

View file

@ -664,7 +664,7 @@ angular.mock.animate = angular.module('mock.animate', ['ng'])
var animate = {
queue : [],
enabled : $delegate.enabled,
process : function(name) {
flushNext : function(name) {
var tick = animate.queue.shift();
expect(tick.method).toBe(name);
tick.fn();

View file

@ -322,27 +322,27 @@ describe('ngClass animations', function() {
$rootScope.val = 'one';
$rootScope.$digest();
$animate.process('addClass');
$animate.process('addClass');
$animate.flushNext('addClass');
$animate.flushNext('addClass');
$timeout.flush();
expect($animate.queue.length).toBe(0);
$rootScope.val = '';
$rootScope.$digest();
$animate.process('removeClass'); //only removeClass is called
$animate.flushNext('removeClass'); //only removeClass is called
expect($animate.queue.length).toBe(0);
$timeout.flush();
$rootScope.val = 'one';
$rootScope.$digest();
$animate.process('addClass');
$animate.flushNext('addClass');
$timeout.flush();
expect($animate.queue.length).toBe(0);
$rootScope.val = 'two';
$rootScope.$digest();
$animate.process('removeClass');
$animate.process('addClass');
$animate.flushNext('removeClass');
$animate.flushNext('addClass');
$timeout.flush();
expect($animate.queue.length).toBe(0);
}));

View file

@ -119,7 +119,7 @@ describe('ngIf animations', function () {
$rootScope.$digest();
$scope.$apply('value = true');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('Hi');
expect(element.children().length).toBe(1);
@ -136,13 +136,13 @@ describe('ngIf animations', function () {
))($scope);
$scope.$apply('value = true');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('Hi');
$scope.$apply('value = false');
expect(element.children().length).toBe(1);
item = $animate.process('leave').element;
item = $animate.flushNext('leave').element;
expect(item.text()).toBe('Hi');
expect(element.children().length).toBe(0);

View file

@ -388,7 +388,7 @@ describe('ngInclude animations', function() {
))($rootScope);
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('data');
}));
@ -404,13 +404,13 @@ describe('ngInclude animations', function() {
))($rootScope);
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('data');
$rootScope.tpl = '';
$rootScope.$digest();
item = $animate.process('leave').element;
item = $animate.flushNext('leave').element;
expect(item.text()).toBe('data');
}));
@ -427,14 +427,14 @@ describe('ngInclude animations', function() {
))($rootScope);
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('one');
$rootScope.tpl = 'two';
$rootScope.$digest();
var itemA = $animate.process('leave').element;
var itemB = $animate.process('enter').element;
var itemA = $animate.flushNext('leave').element;
var itemB = $animate.flushNext('enter').element;
expect(itemA.attr('ng-include')).toBe('tpl');
expect(itemB.attr('ng-include')).toBe('tpl');
expect(itemA).not.toEqual(itemB);

View file

@ -907,13 +907,13 @@ describe('ngRepeat animations', function() {
$rootScope.items = ['1','2','3'];
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('1');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('2');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('3');
}));
@ -932,19 +932,19 @@ describe('ngRepeat animations', function() {
$rootScope.items = ['1','2','3'];
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('1');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('2');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('3');
$rootScope.items = ['1','3'];
$rootScope.$digest();
item = $animate.process('leave').element;
item = $animate.flushNext('leave').element;
expect(item.text()).toBe('2');
}));
@ -964,22 +964,22 @@ describe('ngRepeat animations', function() {
$rootScope.items = ['1','2','3'];
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('1');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('2');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('3');
$rootScope.items = ['2','3','1'];
$rootScope.$digest();
item = $animate.process('move').element;
item = $animate.flushNext('move').element;
expect(item.text()).toBe('2');
item = $animate.process('move').element;
item = $animate.flushNext('move').element;
expect(item.text()).toBe('1');
}));

View file

@ -81,14 +81,14 @@ describe('ngShow / ngHide animations', function() {
))($scope);
$scope.$digest();
item = $animate.process('removeClass').element;
item = $animate.flushNext('removeClass').element;
expect(item.text()).toBe('data');
expect(item).toBeShown();
$scope.on = false;
$scope.$digest();
item = $animate.process('addClass').element;
item = $animate.flushNext('addClass').element;
expect(item.text()).toBe('data');
expect(item).toBeHidden();
}));
@ -104,14 +104,14 @@ describe('ngShow / ngHide animations', function() {
))($scope);
$scope.$digest();
item = $animate.process('addClass').element;
item = $animate.flushNext('addClass').element;
expect(item.text()).toBe('datum');
expect(item).toBeHidden();
$scope.off = false;
$scope.$digest();
item = $animate.process('removeClass').element;
item = $animate.flushNext('removeClass').element;
expect(item.text()).toBe('datum');
expect(item).toBeShown();
}));

View file

@ -255,7 +255,7 @@ describe('ngSwitch animations', function() {
$scope.val = 'one';
$scope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('one');
}));
@ -276,16 +276,16 @@ describe('ngSwitch animations', function() {
$scope.val = 'two';
$scope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('two');
$scope.val = 'three';
$scope.$digest();
item = $animate.process('leave').element;
item = $animate.flushNext('leave').element;
expect(item.text()).toBe('two');
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('three');
}));

View file

@ -556,7 +556,7 @@ describe('ngView animations', function() {
$location.path('/foo');
$rootScope.$digest();
var item = $animate.process('enter').element;
var item = $animate.flushNext('enter').element;
expect(item.text()).toBe('data');
}));
@ -570,13 +570,13 @@ describe('ngView animations', function() {
$location.path('/foo');
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('foo');
$location.path('/');
$rootScope.$digest();
item = $animate.process('leave').element;
item = $animate.flushNext('leave').element;
expect(item.text()).toBe('foo');
}));
@ -590,15 +590,15 @@ describe('ngView animations', function() {
$location.path('/foo');
$rootScope.$digest();
item = $animate.process('enter').element;
item = $animate.flushNext('enter').element;
expect(item.text()).toBe('data');
$location.path('/bar');
$rootScope.$digest();
var itemA = $animate.process('leave').element;
var itemA = $animate.flushNext('leave').element;
expect(itemA).not.toEqual(itemB);
var itemB = $animate.process('enter').element;
var itemB = $animate.flushNext('enter').element;
}));
});
@ -627,12 +627,12 @@ describe('ngView animations', function() {
$location.path('/foo');
$rootScope.$digest();
$animate.process('enter'); //ngView
$animate.flushNext('enter'); //ngView
$timeout.flush();
$animate.process('enter'); //repeat 1
$animate.process('enter'); //repeat 2
$animate.flushNext('enter'); //repeat 1
$animate.flushNext('enter'); //repeat 2
$timeout.flush();
@ -641,16 +641,16 @@ describe('ngView animations', function() {
$location.path('/bar');
$rootScope.$digest();
$animate.process('leave'); //ngView old
$animate.flushNext('leave'); //ngView old
$timeout.flush();
$animate.process('enter'); //ngView new
$animate.flushNext('enter'); //ngView new
$timeout.flush();
expect(n(element.text())).toEqual(''); //this is midway during the animation
$animate.process('enter'); //ngRepeat 3
$animate.process('enter'); //ngRepeat 4
$animate.flushNext('enter'); //ngRepeat 3
$animate.flushNext('enter'); //ngRepeat 4
$timeout.flush();