mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 03:30:02 +08:00
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
This commit is contained in:
committed by
Igor Minar
parent
cf5e463abd
commit
4f84f6b3e4
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user