ionicScrollController: do not try to remember scorll if no viewId

This commit is contained in:
Andy Joslin
2014-03-19 16:51:18 -06:00
parent 73b750fb37
commit 4e1140702b
2 changed files with 22 additions and 10 deletions

View File

@@ -91,6 +91,17 @@ describe('$ionicScroll Controller', function() {
expect(ctrl.scrollView.resize).toHaveBeenCalled();
});
it('should not remember scroll position on $viewContentLoaded if no viewId', function() {
var historyData = {};
setup();
spyOn(ctrl, 'rememberScrollPosition');
spyOn(ctrl, 'scrollToRememberedPosition');
scope.$broadcast('$viewContentLoaded', historyData);
timeout.flush();
expect(ctrl.rememberScrollPosition).not.toHaveBeenCalledWith();
expect(ctrl.scrollToRememberedPosition).not.toHaveBeenCalled();
});
it('should remember scroll position on $viewContentLoaded event', function() {
var historyData = { viewId: '1' };
setup();