Skip to content

Commit

Permalink
Merge pull request #84 from PolymerLabs/scroller-fix
Browse files Browse the repository at this point in the history
Fix timing issue
  • Loading branch information
frankiefu committed Feb 24, 2016
2 parents 6ac6c48 + 312d640 commit 488a475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
5 changes: 3 additions & 2 deletions app-header-layout/app-header-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#contentContainer {
position: relative;
overflow-y: hidden;
@apply(--app-header-layout-content);
}

</style>
Expand Down Expand Up @@ -146,9 +147,10 @@
* @method resetLayout
*/
resetLayout: function() {
this._updateScroller();
this.debounce('_resetLayout', function() {
this._updateContentPosition();
this._updateScroller();
this._updateFixedNodesPosition();
});
},

Expand Down Expand Up @@ -190,7 +192,6 @@
var header = this.header;
if (header) {
header.scroller = this.hasScrollingRegion ? this.$.contentContainer : window;
this._updateFixedNodesPosition();
}
},

Expand Down
12 changes: 2 additions & 10 deletions app-header-layout/test/app-header-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,9 @@
assert.equal(header.scroller, window);
});

test('scrolling region', function(done) {
test('scrolling region', function() {
headerLayout.hasScrollingRegion = true;

window.setTimeout(function() {
/**
* Use window.toString() to avoid potential comparisons between window with itself
* which causes a misleading "JSON.stringify cannot serialize cyclic structures" error.
*/
assert.notEqual(header.scroller.toString(), window.toString());
done();
}, 100);
assert.isTrue(header.scroller !== window, 'scroller should not point to the document element');
});

});
Expand Down

0 comments on commit 488a475

Please sign in to comment.