Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make test in react-test-renderer painless #1121

Merged
merged 3 commits into from
Jun 1, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions source/Grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,16 @@ class Grid extends React.PureComponent<Props, State> {
});
}

// setting the ref's scrollLeft and scrollTop.
// Somehow in MultiGrid the main grid doesn't trigger a update on mount.
if (this._scrollingContainer.scrollLeft !== this.state.scrollLeft) {
this._scrollingContainer.scrollLeft = this.state.scrollLeft;
}
if (this._scrollingContainer.scrollTop !== this.state.scrollTop) {
this._scrollingContainer.scrollTop = this.state.scrollTop;
// refs don't work in `react-test-renderer`
if (this._scrollingContainer) {
// setting the ref's scrollLeft and scrollTop.
// Somehow in MultiGrid the main grid doesn't trigger a update on mount.
if (this._scrollingContainer.scrollLeft !== this.state.scrollLeft) {
this._scrollingContainer.scrollLeft = this.state.scrollLeft;
}
if (this._scrollingContainer.scrollTop !== this.state.scrollTop) {
this._scrollingContainer.scrollTop = this.state.scrollTop;
}
}

// Don't update scroll offset if the size is 0; we don't render any cells in this case.
Expand Down