Skip to content

Commit

Permalink
Fix scrollBehavior='none' on path update
Browse files Browse the repository at this point in the history
Fixes #369.

Test Plan: npm test
  • Loading branch information
sophiebits committed Oct 8, 2014
1 parent 93e7341 commit caf3a2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/mixins/ScrollContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},

/**
Expand Down
6 changes: 6 additions & 0 deletions modules/mixins/__tests__/ScrollContext-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit caf3a2b

Please sign in to comment.