aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng
diff options
context:
space:
mode:
authorMatias Niemelä2014-02-14 04:02:46 -0500
committerIgor Minar2014-02-14 16:30:48 -0800
commit4f84f6b3e4210ae1eb14728a46d43dd961700a0c (patch)
tree7194406fbd76e553687200fb1a6a284ca8ca1e60 /test/ng
parentcf5e463abd2c23f62e9c2e6361e6c53048c8910e (diff)
downloadangular.js-4f84f6b3e4210ae1eb14728a46d43dd961700a0c.tar.bz2
fix($animate): ensure $animate doesn't break natural CSS transitions
BREAKING CHANGE: ngClass and {{ class }} will now call the `setClass` animation callback instead of addClass / removeClass when both a addClass/removeClass operation is being executed on the element during the animation. Please include the setClass animation callback as well as addClass and removeClass within your JS animations to work with ngClass and {{ class }} directives. Closes #6019
Diffstat (limited to 'test/ng')
-rwxr-xr-xtest/ng/compileSpec.js6
-rw-r--r--test/ng/directive/ngClassSpec.js10
2 files changed, 5 insertions, 11 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index e9ab15e4..98b1650f 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -4666,11 +4666,9 @@ describe('$compile', function() {
$rootScope.$digest();
data = $animate.queue.shift();
- expect(data.event).toBe('removeClass');
- expect(data.args[1]).toBe('rice');
- data = $animate.queue.shift();
- expect(data.event).toBe('addClass');
+ expect(data.event).toBe('setClass');
expect(data.args[1]).toBe('dice');
+ expect(data.args[2]).toBe('rice');
expect(element.hasClass('ice')).toBe(true);
expect(element.hasClass('dice')).toBe(true);
diff --git a/test/ng/directive/ngClassSpec.js b/test/ng/directive/ngClassSpec.js
index b162fea6..b11c4766 100644
--- a/test/ng/directive/ngClassSpec.js
+++ b/test/ng/directive/ngClassSpec.js
@@ -335,8 +335,7 @@ describe('ngClass animations', function() {
$rootScope.val = 'two';
$rootScope.$digest();
- expect($animate.queue.shift().event).toBe('removeClass');
- expect($animate.queue.shift().event).toBe('addClass');
+ expect($animate.queue.shift().event).toBe('setClass');
expect($animate.queue.length).toBe(0);
});
});
@@ -450,12 +449,9 @@ describe('ngClass animations', function() {
$rootScope.$digest();
item = $animate.queue.shift();
- expect(item.event).toBe('removeClass');
- expect(item.args[1]).toBe('two');
-
- item = $animate.queue.shift();
- expect(item.event).toBe('addClass');
+ expect(item.event).toBe('setClass');
expect(item.args[1]).toBe('three');
+ expect(item.args[2]).toBe('two');
expect($animate.queue.length).toBe(0);
});