aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng
diff options
context:
space:
mode:
authorMatias Niemelä2014-02-24 19:43:57 -0500
committerMatias Niemelä2014-02-24 21:23:18 -0500
commit4c4537e65e6cf911c9659b562d89e3330ce3ffae (patch)
tree3f9e6736a314073b5516beab3c86d7709e887b6b /test/ng
parent62761428eff3a53e69367449eb81869e59e75e39 (diff)
downloadangular.js-4c4537e65e6cf911c9659b562d89e3330ce3ffae.tar.bz2
perf($animate): use rAF instead of timeouts to issue animation callbacks
Diffstat (limited to 'test/ng')
-rw-r--r--test/ng/directive/ngClassSpec.js5
-rw-r--r--test/ng/directive/ngIncludeSpec.js14
2 files changed, 10 insertions, 9 deletions
diff --git a/test/ng/directive/ngClassSpec.js b/test/ng/directive/ngClassSpec.js
index b11c4766..83cd3000 100644
--- a/test/ng/directive/ngClassSpec.js
+++ b/test/ng/directive/ngClassSpec.js
@@ -345,6 +345,7 @@ describe('ngClass animations', function() {
//mocks are not used since the enter delegation method is called before addClass and
//it makes it impossible to test to see that addClass is called first
module('ngAnimate');
+ module('ngAnimateMock');
var digestQueue = [];
module(function($animateProvider) {
@@ -367,7 +368,7 @@ describe('ngClass animations', function() {
};
};
});
- inject(function($compile, $rootScope, $rootElement, $animate, $timeout, $document) {
+ inject(function($compile, $rootScope, $browser, $rootElement, $animate, $timeout, $document) {
// Enable animations by triggering the first item in the postDigest queue
digestQueue.shift()();
@@ -407,7 +408,7 @@ describe('ngClass animations', function() {
//is spaced-out then it is required so that the original digestion
//is kicked into gear
$rootScope.$digest();
- $timeout.flush();
+ $animate.triggerCallbacks();
expect(element.data('state')).toBe('crazy-enter');
expect(enterComplete).toBe(true);
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js
index ebb35147..9f37d1fe 100644
--- a/test/ng/directive/ngIncludeSpec.js
+++ b/test/ng/directive/ngIncludeSpec.js
@@ -368,7 +368,7 @@ describe('ngInclude', function() {
expect(autoScrollSpy).not.toHaveBeenCalled();
expect($animate.queue.shift().event).toBe('enter');
- $timeout.flush();
+ $animate.triggerCallbacks();
expect(autoScrollSpy).toHaveBeenCalledOnce();
}));
@@ -385,7 +385,7 @@ describe('ngInclude', function() {
});
expect($animate.queue.shift().event).toBe('enter');
- $timeout.flush();
+ $animate.triggerCallbacks();
$rootScope.$apply(function () {
$rootScope.tpl = 'another.html';
@@ -394,7 +394,7 @@ describe('ngInclude', function() {
expect($animate.queue.shift().event).toBe('leave');
expect($animate.queue.shift().event).toBe('enter');
- $timeout.flush();
+ $animate.triggerCallbacks();
$rootScope.$apply(function() {
$rootScope.tpl = 'template.html';
@@ -403,7 +403,7 @@ describe('ngInclude', function() {
expect($animate.queue.shift().event).toBe('leave');
expect($animate.queue.shift().event).toBe('enter');
- $timeout.flush();
+ $animate.triggerCallbacks();
expect(autoScrollSpy).toHaveBeenCalled();
expect(autoScrollSpy.callCount).toBe(3);
@@ -419,7 +419,7 @@ describe('ngInclude', function() {
});
expect($animate.queue.shift().event).toBe('enter');
- $timeout.flush();
+ $animate.triggerCallbacks();
expect(autoScrollSpy).not.toHaveBeenCalled();
}));
@@ -435,7 +435,7 @@ describe('ngInclude', function() {
});
expect($animate.queue.shift().event).toBe('enter');
- $timeout.flush();
+ $animate.triggerCallbacks();
$rootScope.$apply(function () {
$rootScope.tpl = 'template.html';
@@ -457,7 +457,7 @@ describe('ngInclude', function() {
$rootScope.$apply("tpl = 'template.html'");
expect($animate.queue.shift().event).toBe('enter');
- $timeout.flush();
+ $animate.triggerCallbacks();
expect(autoScrollSpy).toHaveBeenCalledOnce();
}));