mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 19:40:56 +08:00
chore(ngMock): rename $animate.process to $animate.flushNext()
This commit is contained in:
committed by
Misko Hevery
parent
52a7c351c9
commit
85d705ab69
@@ -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);
|
||||
}));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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');
|
||||
}));
|
||||
|
||||
|
||||
@@ -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();
|
||||
}));
|
||||
|
||||
@@ -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');
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user