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

Grid: rendering using react-test-renderer breaks in 9.19.0 #1117

Closed
wuweiweiwu opened this issue May 22, 2018 · 7 comments
Closed

Grid: rendering using react-test-renderer breaks in 9.19.0 #1117

wuweiweiwu opened this issue May 22, 2018 · 7 comments
Assignees
Labels

Comments

@wuweiweiwu
Copy link
Contributor

import renderer from 'react-test-renderer';

const tree = renderer
      .create(<Grid ... />)
      .toJSON();

Error message:

      Error: Uncaught [TypeError: Cannot read property 'scrollLeft' of null]

Possibly not working because react-test-renderer doesn't support the polyfilled lifecycle functions?

@wuweiweiwu wuweiweiwu self-assigned this May 22, 2018
@wuweiweiwu wuweiweiwu added the bug label May 22, 2018
@wuweiweiwu
Copy link
Contributor Author

@wuweiweiwu wuweiweiwu assigned wuweiweiwu and unassigned wuweiweiwu May 22, 2018
@wuweiweiwu
Copy link
Contributor Author

facebook/react#7740 react-test-renderer. Doesn't support refs. Need to pass in createNodeMock option

@nihgwu
Copy link
Contributor

nihgwu commented May 24, 2018

@wuweiweiwu but how can I pass createNodeMock to Grid? I created a Table component on Grid, and testing the Table component

@nihgwu
Copy link
Contributor

nihgwu commented May 24, 2018

can we check before accessing the ref here? https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/Grid.js#L627

@wuweiweiwu
Copy link
Contributor Author

createNodeMock is an option in react-test-renderer
https://reactjs.org/docs/test-renderer.html#ideas

@wuweiweiwu
Copy link
Contributor Author

If you want to contribute a PR that'll be awesome!!

@nihgwu
Copy link
Contributor

nihgwu commented May 24, 2018

@wuweiweiwu seems createNodeMock is applied to all the nested components when creating, but that's still odd to me that I have to add that option manually in every test case, I'm testing my own Table component, and don't use refs in cDM, Grid should be transparent for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants