aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/directive')
-rw-r--r--test/ng/directive/ngClassSpec.js30
-rwxr-xr-xtest/ng/directive/ngIfSpec.js17
-rw-r--r--test/ng/directive/ngIncludeSpec.js41
-rw-r--r--test/ng/directive/ngRepeatSpec.js60
-rw-r--r--test/ng/directive/ngShowHideSpec.js28
-rw-r--r--test/ng/directive/ngSwitchSpec.js20
6 files changed, 113 insertions, 83 deletions
diff --git a/test/ng/directive/ngClassSpec.js b/test/ng/directive/ngClassSpec.js
index 3e466068..976c0c3f 100644
--- a/test/ng/directive/ngClassSpec.js
+++ b/test/ng/directive/ngClassSpec.js
@@ -320,23 +320,23 @@ describe('ngClass animations', function() {
$rootScope.val = 'one';
$rootScope.$digest();
- $animate.flushNext('addClass');
+ expect($animate.queue.shift().event).toBe('addClass');
expect($animate.queue.length).toBe(0);
$rootScope.val = '';
$rootScope.$digest();
- $animate.flushNext('removeClass'); //only removeClass is called
+ expect($animate.queue.shift().event).toBe('removeClass'); //only removeClass is called
expect($animate.queue.length).toBe(0);
$rootScope.val = 'one';
$rootScope.$digest();
- $animate.flushNext('addClass');
+ expect($animate.queue.shift().event).toBe('addClass');
expect($animate.queue.length).toBe(0);
$rootScope.val = 'two';
$rootScope.$digest();
- $animate.flushNext('removeClass');
- $animate.flushNext('addClass');
+ expect($animate.queue.shift().event).toBe('removeClass');
+ expect($animate.queue.shift().event).toBe('addClass');
expect($animate.queue.length).toBe(0);
});
});
@@ -430,16 +430,18 @@ describe('ngClass animations', function() {
$rootScope.$digest();
//this fires twice due to the class observer firing
- className = $animate.flushNext('addClass').params[1];
- expect(className).toBe('one two three');
+ var item = $animate.queue.shift();
+ expect(item.event).toBe('addClass');
+ expect(item.args[1]).toBe('one two three');
expect($animate.queue.length).toBe(0);
$rootScope.three = false;
$rootScope.$digest();
- className = $animate.flushNext('removeClass').params[1];
- expect(className).toBe('three');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('removeClass');
+ expect(item.args[1]).toBe('three');
expect($animate.queue.length).toBe(0);
@@ -447,11 +449,13 @@ describe('ngClass animations', function() {
$rootScope.three = true;
$rootScope.$digest();
- className = $animate.flushNext('removeClass').params[1];
- expect(className).toBe('two');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('removeClass');
+ expect(item.args[1]).toBe('two');
- className = $animate.flushNext('addClass').params[1];
- expect(className).toBe('three');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('addClass');
+ expect(item.args[1]).toBe('three');
expect($animate.queue.length).toBe(0);
});
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);
}));
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js
index 79e7f312..38038559 100644
--- a/test/ng/directive/ngIncludeSpec.js
+++ b/test/ng/directive/ngIncludeSpec.js
@@ -367,7 +367,7 @@ describe('ngInclude', function() {
});
expect(autoScrollSpy).not.toHaveBeenCalled();
- $animate.flushNext('enter');
+ expect($animate.queue.shift().event).toBe('enter');
$timeout.flush();
expect(autoScrollSpy).toHaveBeenCalledOnce();
@@ -384,7 +384,7 @@ describe('ngInclude', function() {
$rootScope.value = true;
});
- $animate.flushNext('enter');
+ expect($animate.queue.shift().event).toBe('enter');
$timeout.flush();
$rootScope.$apply(function () {
@@ -392,8 +392,8 @@ describe('ngInclude', function() {
$rootScope.value = 'some-string';
});
- $animate.flushNext('leave');
- $animate.flushNext('enter');
+ expect($animate.queue.shift().event).toBe('leave');
+ expect($animate.queue.shift().event).toBe('enter');
$timeout.flush();
$rootScope.$apply(function() {
@@ -401,8 +401,8 @@ describe('ngInclude', function() {
$rootScope.value = 100;
});
- $animate.flushNext('leave');
- $animate.flushNext('enter');
+ expect($animate.queue.shift().event).toBe('leave');
+ expect($animate.queue.shift().event).toBe('enter');
$timeout.flush();
expect(autoScrollSpy).toHaveBeenCalled();
@@ -418,7 +418,7 @@ describe('ngInclude', function() {
$rootScope.tpl = 'template.html';
});
- $animate.flushNext('enter');
+ expect($animate.queue.shift().event).toBe('enter');
$timeout.flush();
expect(autoScrollSpy).not.toHaveBeenCalled();
}));
@@ -434,7 +434,7 @@ describe('ngInclude', function() {
$rootScope.value = false;
});
- $animate.flushNext('enter');
+ expect($animate.queue.shift().event).toBe('enter');
$timeout.flush();
$rootScope.$apply(function () {
@@ -456,7 +456,7 @@ describe('ngInclude', function() {
expect(autoScrollSpy).not.toHaveBeenCalled();
$rootScope.$apply("tpl = 'template.html'");
- $animate.flushNext('enter');
+ expect($animate.queue.shift().event).toBe('enter');
$timeout.flush();
expect(autoScrollSpy).toHaveBeenCalledOnce();
@@ -608,8 +608,9 @@ describe('ngInclude animations', function() {
))($rootScope);
$rootScope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('data');
+ var animation = $animate.queue.pop();
+ expect(animation.event).toBe('enter');
+ expect(animation.element.text()).toBe('data');
}));
it('should fire off the leave animation',
@@ -624,14 +625,16 @@ describe('ngInclude animations', function() {
))($rootScope);
$rootScope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('data');
+ var animation = $animate.queue.shift();
+ expect(animation.event).toBe('enter');
+ expect(animation.element.text()).toBe('data');
$rootScope.tpl = '';
$rootScope.$digest();
- item = $animate.flushNext('leave').element;
- expect(item.text()).toBe('data');
+ animation = $animate.queue.shift();
+ expect(animation.event).toBe('leave');
+ expect(animation.element.text()).toBe('data');
}));
it('should animate two separate ngInclude elements',
@@ -647,14 +650,14 @@ describe('ngInclude animations', function() {
))($rootScope);
$rootScope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('one');
+ var item1 = $animate.queue.shift().element;
+ expect(item1.text()).toBe('one');
$rootScope.tpl = 'two';
$rootScope.$digest();
- var itemA = $animate.flushNext('leave').element;
- var itemB = $animate.flushNext('enter').element;
+ var itemA = $animate.queue.shift().element;
+ var itemB = $animate.queue.shift().element;
expect(itemA.attr('ng-include')).toBe('tpl');
expect(itemB.attr('ng-include')).toBe('tpl');
expect(itemA).not.toEqual(itemB);
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js
index 638f082c..8bcb9283 100644
--- a/test/ng/directive/ngRepeatSpec.js
+++ b/test/ng/directive/ngRepeatSpec.js
@@ -1182,14 +1182,17 @@ describe('ngRepeat animations', function() {
$rootScope.items = ['1','2','3'];
$rootScope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('1');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('1');
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('2');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('2');
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('3');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('3');
}));
it('should fire off the leave animation',
@@ -1207,20 +1210,24 @@ describe('ngRepeat animations', function() {
$rootScope.items = ['1','2','3'];
$rootScope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('1');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('1');
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('2');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('2');
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('3');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('3');
$rootScope.items = ['1','3'];
$rootScope.$digest();
- item = $animate.flushNext('leave').element;
- expect(item.text()).toBe('2');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('leave');
+ expect(item.element.text()).toBe('2');
}));
it('should fire off the move animation',
@@ -1239,23 +1246,28 @@ describe('ngRepeat animations', function() {
$rootScope.items = ['1','2','3'];
$rootScope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('1');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('1');
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('2');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('2');
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('3');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('3');
$rootScope.items = ['2','3','1'];
$rootScope.$digest();
- item = $animate.flushNext('move').element;
- expect(item.text()).toBe('2');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('move');
+ expect(item.element.text()).toBe('2');
- item = $animate.flushNext('move').element;
- expect(item.text()).toBe('1');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('move');
+ expect(item.element.text()).toBe('3');
}));
});
diff --git a/test/ng/directive/ngShowHideSpec.js b/test/ng/directive/ngShowHideSpec.js
index 30397c4c..8a25843c 100644
--- a/test/ng/directive/ngShowHideSpec.js
+++ b/test/ng/directive/ngShowHideSpec.js
@@ -91,16 +91,18 @@ describe('ngShow / ngHide animations', function() {
))($scope);
$scope.$digest();
- item = $animate.flushNext('removeClass').element;
- expect(item.text()).toBe('data');
- expect(item).toBeShown();
+ item = $animate.queue.shift();
+ expect(item.event).toBe('removeClass');
+ expect(item.element.text()).toBe('data');
+ expect(item.element).toBeShown();
$scope.on = false;
$scope.$digest();
- item = $animate.flushNext('addClass').element;
- expect(item.text()).toBe('data');
- expect(item).toBeHidden();
+ item = $animate.queue.shift();
+ expect(item.event).toBe('addClass');
+ expect(item.element.text()).toBe('data');
+ expect(item.element).toBeHidden();
}));
});
@@ -114,16 +116,18 @@ describe('ngShow / ngHide animations', function() {
))($scope);
$scope.$digest();
- item = $animate.flushNext('addClass').element;
- expect(item.text()).toBe('datum');
- expect(item).toBeHidden();
+ item = $animate.queue.shift();
+ expect(item.event).toBe('addClass');
+ expect(item.element.text()).toBe('datum');
+ expect(item.element).toBeHidden();
$scope.off = false;
$scope.$digest();
- item = $animate.flushNext('removeClass').element;
- expect(item.text()).toBe('datum');
- expect(item).toBeShown();
+ item = $animate.queue.shift();
+ expect(item.event).toBe('removeClass');
+ expect(item.element.text()).toBe('datum');
+ expect(item.element).toBeShown();
}));
});
});
diff --git a/test/ng/directive/ngSwitchSpec.js b/test/ng/directive/ngSwitchSpec.js
index e4cd483c..a8c91359 100644
--- a/test/ng/directive/ngSwitchSpec.js
+++ b/test/ng/directive/ngSwitchSpec.js
@@ -255,8 +255,9 @@ describe('ngSwitch animations', function() {
$scope.val = 'one';
$scope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('one');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('one');
}));
@@ -276,17 +277,20 @@ describe('ngSwitch animations', function() {
$scope.val = 'two';
$scope.$digest();
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('two');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('two');
$scope.val = 'three';
$scope.$digest();
- item = $animate.flushNext('leave').element;
- expect(item.text()).toBe('two');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('leave');
+ expect(item.element.text()).toBe('two');
- item = $animate.flushNext('enter').element;
- expect(item.text()).toBe('three');
+ item = $animate.queue.shift();
+ expect(item.event).toBe('enter');
+ expect(item.element.text()).toBe('three');
}));
});