From 4e6ba5b8185b623f2ef6c6d5f45f77361792b829 Mon Sep 17 00:00:00 2001 From: Perry Govier Date: Thu, 24 Jul 2014 12:27:42 -0500 Subject: [PATCH] refactor(scroll): minor tweak to make unit tests happy --- js/angular/controller/scrollController.js | 2 +- test/unit/angular/controller/scrollController.unit.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/angular/controller/scrollController.js b/js/angular/controller/scrollController.js index f04f5bb87b..af27550986 100644 --- a/js/angular/controller/scrollController.js +++ b/js/angular/controller/scrollController.js @@ -157,7 +157,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca if(curElm !== null)scrollTop += curElm.offsetTop; curElm = curElm.offsetParent; levelsClimbed++; - } while (curElm.attributes != self.element.attributes && curElm.offsetParent !== null); + } while (curElm.attributes != self.element.attributes && curElm.offsetParent); scrollView.scrollTo(scrollLeft, scrollTop, !!shouldAnimate); }); }; diff --git a/test/unit/angular/controller/scrollController.unit.js b/test/unit/angular/controller/scrollController.unit.js index ab677a8007..f4315dc37b 100644 --- a/test/unit/angular/controller/scrollController.unit.js +++ b/test/unit/angular/controller/scrollController.unit.js @@ -310,7 +310,7 @@ describe('$ionicScroll Controller', function() { }); }); - it('should work', function() { + it('.anchorScroll with el matching hash should scroll to it, even if the el is not directly below the list', function() { var ele = { offsetLeft: 8, offsetTop: 9,