mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(refresher): finish animating before changing icon, hide when not in use
This commit is contained in:
@@ -354,10 +354,12 @@ describe('$ionicScroll Controller', function() {
|
||||
setup({
|
||||
el: angular.element('<div><div class="scroll-refresher"></div></div>')[0]
|
||||
});
|
||||
spyOn(ctrl.scrollView, 'activatePullToRefresh').andCallFake(function(height, start, refreshing, done) {
|
||||
spyOn(ctrl.scrollView, 'activatePullToRefresh').andCallFake(function(height, start, refreshing, done, show, hide) {
|
||||
startCb = start;
|
||||
refreshingCb = refreshing;
|
||||
doneCb = done;
|
||||
showCb = show;
|
||||
hideCb = hide;
|
||||
});
|
||||
ctrl._setRefresher(scope, ctrl.element);
|
||||
|
||||
@@ -378,15 +380,26 @@ describe('$ionicScroll Controller', function() {
|
||||
expect(scope.$onPulling).toHaveBeenCalled();
|
||||
|
||||
refreshingCb();
|
||||
expect(refresher.classList.contains('active')).toBe(false);
|
||||
expect(refresher.classList.contains('active')).toBe(true);
|
||||
expect(refresher.classList.contains('refreshing')).toBe(false);
|
||||
|
||||
expect(scope.$onRefresh).not.toHaveBeenCalled();
|
||||
|
||||
doneCb();
|
||||
expect(refresher.classList.contains('active')).toBe(false);
|
||||
expect(refresher.classList.contains('active')).toBe(true);
|
||||
expect(refresher.classList.contains('refreshing')).toBe(true);
|
||||
expect(scope.$onRefresh).toHaveBeenCalled();
|
||||
timeout.flush();
|
||||
|
||||
expect(refresher.classList.contains('active')).toBe(false);
|
||||
expect(refresher.classList.contains('refreshing')).toBe(false);
|
||||
expect(refresher.classList.contains('invisible')).toBe(true);
|
||||
|
||||
showCb();
|
||||
expect(refresher.classList.contains('invisible')).toBe(false);
|
||||
|
||||
hideCb();
|
||||
expect(refresher.classList.contains('invisible')).toBe(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user