Skip to content

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