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

Stop document.createElement in tests #1250

Closed
zpao opened this issue Mar 12, 2014 · 5 comments · Fixed by #2597
Closed

Stop document.createElement in tests #1250

zpao opened this issue Mar 12, 2014 · 5 comments · Fixed by #2597

Comments

@zpao
Copy link
Member

zpao commented Mar 12, 2014

We have a ton of places that do

var container = document.createElement('div');
var component = <Something />;
var instance = React.renderComponent(component, container);

We should just be doing

var component = <Something />;
var instance = ReactTestUtils.renderIntoDocument(component);

This isn't an exciting task, but gets you exposed to lots of tests which can help with understanding react core better. cc @kmeht

@zpao
Copy link
Member Author

zpao commented Mar 12, 2014

@sebmarkbage has a codmod coming that touches a bunch of these, so don't jump in quite yet.

@kmeht
Copy link
Contributor

kmeht commented Mar 13, 2014

Okay, keep me posted. I'll manually fix any callsites that slip through the codemod.

@zpao
Copy link
Member Author

zpao commented Mar 17, 2014

Codemod in. He wasn't actually fixing them, just touching code around them so would have been merge hell.

@danielschonfeld
Copy link
Contributor

Is it safe to try to get those patched now?

@zpao
Copy link
Member Author

zpao commented May 12, 2014

It should be. Feel free to take it on. Let me know if you have any questions!

jimfb added a commit to jimfb/react that referenced this issue Nov 25, 2014
…t where container was not subsequently utilized.

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

Successfully merging a pull request may close this issue.

3 participants