diff --git a/modules/mixins/ScrollContext.js b/modules/mixins/ScrollContext.js index e4c714ee13..13a91e5e1d 100644 --- a/modules/mixins/ScrollContext.js +++ b/modules/mixins/ScrollContext.js @@ -76,10 +76,10 @@ var ScrollContext = { updateScroll: function (path, actionType) { var behavior = this.getScrollBehavior(); - var position = this._scrollPositions[path]; - if (behavior && position) - behavior.updateScrollPosition(position, actionType); + if (behavior != null && this._scrollPositions.hasOwnProperty(path)) { + behavior.updateScrollPosition(this._scrollPositions[path], actionType); + } }, /** diff --git a/modules/mixins/__tests__/ScrollContext-test.js b/modules/mixins/__tests__/ScrollContext-test.js index 84d8461f18..bfdb499705 100644 --- a/modules/mixins/__tests__/ScrollContext-test.js +++ b/modules/mixins/__tests__/ScrollContext-test.js @@ -29,6 +29,12 @@ describe('ScrollContext', function () { it('has a null scroll behavior', function () { expect(component.getScrollBehavior()).toBe(null); }); + + it('does not throw when updating scroll position', function () { + expect(function() { + component.updateScroll('/'); + }).toNotThrow(); + }); }); describe('when using scrollBehavior="browser"', function () {