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

ReactDOMTextComponent needs getInstance() #2654

Closed
zpao opened this issue Dec 3, 2014 · 6 comments
Closed

ReactDOMTextComponent needs getInstance() #2654

zpao opened this issue Dec 3, 2014 · 6 comments

Comments

@zpao
Copy link
Member

zpao commented Dec 3, 2014

With the recent separation of internal and external instances ReactDOMTextComponents got left out. Certain tools (namely ReactTestUtils) expect that everything in the rendered tree conforms to a certain API. Attempting to sync the last couple weeks of React to FB is causing tests which depend on ReactTestUtils.findAllInRenderedTree to fail as a result.

cc @spicyj @sebmarkbage

@sebmarkbage
Copy link
Collaborator

Unit tests should not get the instance off text components because there shouldn't be an instance and consecutive text components might be merged as an implementation detail.

I thought I cleaned up all internal unit tests that relied on this in my diff? Did you patch in the fixes? Are there new ones?

Or is there something in findAllInRenderedTree that always breaks?

On Dec 3, 2014, at 8:22 PM, Paul O’Shannessy notifications@github.com wrote:

With the recent separation of internal and external instances ReactDOMTextComponents got left out. Certain tools (namely ReactTestUtils) expect that everything in the rendered tree conforms to a certain API. Attempting to sync the last couple weeks of React to FB is causing tests which depend on ReactTestUtils.findAllInRenderedTree to fail as a result.

cc @spicyj @sebmarkbage


Reply to this email directly or view it on GitHub.

@zpao
Copy link
Member Author

zpao commented Dec 4, 2014

I did bring in your other diffs. These aren't new failures but were probably just missed or hidden before.

I believe findAllInRenderedTree will always break if there's a text component since we blindly just call getPublicInstance() https://github.com/facebook/react/blob/master/src/test/ReactTestUtils.js#L127-L132

@sophiebits
Copy link
Collaborator

@sebmarkbage What should React.render("foo", el) return? (That doesn't work at all yet.)

@sebmarkbage
Copy link
Collaborator

Probably null

I was explicitly leaving it to throw for now to validate the assumption that nothing should be trying to get the public instance on text components.

Looks like we need to fix the scry. Not sure why that didn't show up in my tests.

On Dec 3, 2014, at 11:35 PM, Ben Alpert notifications@github.com wrote:

@sebmarkbage What should React.render("foo", el) return? (That doesn't work at all yet.)


Reply to this email directly or view it on GitHub.

@jimfb
Copy link
Contributor

jimfb commented Dec 11, 2014

As per subsequent in-person conversation with @sebmarkbage, we've decided to update the scry instead of adding a getPublicInstance() method to TextComponent

@jimfb
Copy link
Contributor

jimfb commented Feb 10, 2016

Fixed in #2695

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

No branches or pull requests

4 participants