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

Fix ReactTestInstance::toJSON() with empty top-level components #7523

Merged
merged 1 commit into from
Aug 18, 2016

Conversation

alexkirsz
Copy link
Contributor

Since ReactTestInstance::toJSON() doesn't support the case where getHostComponentFromComposite returns null (The component has rendered an empty node), the following code throws:

function Empty() {
  return null;
}
ReactTestRenderer.create(<Empty />).toJSON();

This patch makes ReactTestInstance::toJSON() return null when the top-level component has rendered an empty node.

@aweary
Copy link
Contributor

aweary commented Aug 18, 2016

Seems reasonable to me! Good catch 👍 cc @spicyj

@ghost ghost added the CLA Signed label Aug 18, 2016
@sophiebits sophiebits added this to the 15-next milestone Aug 18, 2016
@sophiebits sophiebits merged commit 9f5b009 into facebook:master Aug 18, 2016
@sophiebits
Copy link
Collaborator

Seems all right to me, thank you!

@ghost ghost added the CLA Signed label Aug 18, 2016
@zpao zpao modified the milestones: 15-next, 15.3.1 Aug 19, 2016
zpao pushed a commit that referenced this pull request Aug 19, 2016
@alexkirsz alexkirsz deleted the testrenderer-empty-component branch August 29, 2016 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants