mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(loading): potential race condition with showing and hiding loading in same watch cycle
This commit is contained in:
7
js/angular/service/loading.js
vendored
7
js/angular/service/loading.js
vendored
@@ -158,8 +158,11 @@ function($ionicLoadingConfig, $document, $ionicTemplateLoader, $ionicBackdrop, $
|
||||
$ionicBackdrop.release();
|
||||
$ionicBackdrop.getElement().removeClass('backdrop-loading');
|
||||
}
|
||||
self.element.removeClass('active');
|
||||
$document[0].body.classList.remove('loading-active');
|
||||
// wrapping in a timeout to make process asyncronous
|
||||
$timeout(function(){
|
||||
self.element.removeClass('active');
|
||||
$document[0].body.classList.remove('loading-active');
|
||||
}, 10);
|
||||
setTimeout(function() {
|
||||
!self.isShown && self.element.removeClass('visible');
|
||||
}, 200);
|
||||
|
||||
@@ -89,6 +89,7 @@ describe('$ionicLoading service', function() {
|
||||
$timeout.flush();
|
||||
expect(angular.element(document.body).hasClass('loading-active')).toBe(true);
|
||||
loader.hide();
|
||||
$timeout.flush();
|
||||
expect(angular.element(document.body).hasClass('loading-active')).toBe(false);
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user