mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-21 10:05:34 +08:00
fix($animate): only execute a timeout when transitions or keyframe animations are used
ngAnimate causes a 1ms flicker on the screen when no CSS animations are present on the element. The solution is to change $animate to only use $timeouts when a duration is found on the element before the transition/keyframe animation takes over. Closes #3613
This commit is contained in:
committed by
Misko Hevery
parent
fb3a7db080
commit
ee2f3d21da
@@ -118,14 +118,12 @@ describe('Docs Annotations', function() {
|
||||
expect(foldout.html()).toContain('loading');
|
||||
}));
|
||||
|
||||
it('should download a foldout HTML page and animate the contents', inject(function($httpBackend, $timeout) {
|
||||
it('should download a foldout HTML page and animate the contents', inject(function($httpBackend, $timeout, $sniffer) {
|
||||
$httpBackend.expect('GET', url).respond('hello');
|
||||
|
||||
element.triggerHandler('click');
|
||||
$httpBackend.flush();
|
||||
|
||||
$timeout.flushNext(0);
|
||||
$timeout.flushNext(1);
|
||||
$timeout.flushNext(0);
|
||||
$timeout.flushNext(1000);
|
||||
|
||||
@@ -134,27 +132,22 @@ describe('Docs Annotations', function() {
|
||||
expect(foldout.text()).toContain('hello');
|
||||
}));
|
||||
|
||||
it('should hide then show when clicked again', inject(function($httpBackend, $timeout) {
|
||||
it('should hide then show when clicked again', inject(function($httpBackend, $timeout, $sniffer) {
|
||||
$httpBackend.expect('GET', url).respond('hello');
|
||||
|
||||
//enter
|
||||
element.triggerHandler('click');
|
||||
$httpBackend.flush();
|
||||
$timeout.flushNext(0);
|
||||
$timeout.flushNext(1);
|
||||
$timeout.flushNext(0);
|
||||
$timeout.flushNext(1000);
|
||||
|
||||
//hide
|
||||
element.triggerHandler('click');
|
||||
$timeout.flushNext(1);
|
||||
$timeout.flushNext(0);
|
||||
$timeout.flushNext(200);
|
||||
$timeout.flushNext(0);
|
||||
|
||||
//show
|
||||
element.triggerHandler('click');
|
||||
$timeout.flushNext(1);
|
||||
$timeout.flushNext(0);
|
||||
$timeout.flushNext(500);
|
||||
$timeout.flushNext(0);
|
||||
|
||||
Reference in New Issue
Block a user