From 5111a56d13eed98445de4c912a45435e3363c00d Mon Sep 17 00:00:00 2001 From: Steve Pitchford Date: Wed, 2 Oct 2019 10:13:17 +0200 Subject: [PATCH] fix: correctly render wrapped components The render function no correctly renders the component if the wrapper option is set. Before this it was rendering to the DOM. --- CONTRIBUTING.md | 2 +- src/__tests__/render.js | 4 +++- src/pure.js | 8 +++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 445f346..12f2b30 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,4 +43,4 @@ Please checkout the [the open issues][issues] Also, please watch the repo and respond to questions/bug reports/feature requests! Thanks! [egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github -[issues]: https://github.com/mihar-22/preact-testing-library/issues +[issues]: https://github.com/testing-library/preact-testing-library/issues diff --git a/src/__tests__/render.js b/src/__tests__/render.js index be10476..fa21845 100644 --- a/src/__tests__/render.js +++ b/src/__tests__/render.js @@ -89,7 +89,9 @@ test('renders options.wrapper around node', () => {
- +
`); }); diff --git a/src/pure.js b/src/pure.js index ae1c06c..feebf2d 100644 --- a/src/pure.js +++ b/src/pure.js @@ -29,11 +29,9 @@ function render( // they're passing us a custom container or not. mountedContainers.add(container); - const wrapUiIfNeeded = (innerElement) => (WrapperComponent ? ( - - - - ) : innerElement); + const wrapUiIfNeeded = (innerElement) => (WrapperComponent + ? h(WrapperComponent, null, innerElement) + : innerElement); preactAct(() => { if (hydrate) {