Skip to content

fix: correctly render wrapped components #20

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

Merged

Conversation

stephenpitchford
Copy link

The render function now correctly renders the component if the wrapper option is set. Before
this it was rendering <innerElement /> to the DOM.

What:

Render the WrapperComponent directly using the h function and pass the innerElement as a child component rather than using JSX syntax in the function. This is how it is done in the react testing library as well.

Also updated the contributing link in the CONTRIBUTING.md file since the link pointed to a different project.

Why:

Calling render with the wrapper option wasn't rendering the actual component, but <innerElement /> so tests would fail due to the component being tested not existing.

How:

The wrapUiIfNeededfunction was updated to directly create components using the h function.

Checklist:

  • Documentation added
  • Tests
  • Typescript definitions updated
  • Ready to be merged

The render function no correctly renders the component if the wrapper option is set. Before
this it was rendering <innerElement /> to the DOM.
@mihar-22 mihar-22 merged commit 39e1f02 into testing-library:master Oct 2, 2019
@antsmartian
Copy link
Collaborator

🎉 This PR is included in version 1.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@stephenpitchford stephenpitchford deleted the render-wrapped-components branch October 2, 2019 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants