-
Describe the bugSolidjs components can not be tested when they rely on Router. Wrapping a Component with any kind of This example Fails with the following Error:
This works without erros, but the resulting baseElement is empty (nothing is rendered):
I also tested Steps to Reproduce the Bug or IssueReproducible here: https://stackblitz.com/edit/node-dbbmnk?file=test%2Fsuite.test.tsx Expected behaviorAt least one version of the now failing tests should work Platform
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The children of const { queryByRole } = render(() => <Counter />, {
wrapper: (props) => {
return (
<Router
root={(props) => (
<RouteAwareWrapper>{props.children}</RouteAwareWrapper>
)}
>
<Route path="/" component={() => <>{props.children}</>} />
</Router>
);
},
}); I believe is the closest to being correct. I'm gathering You could also do this I suppose: const { queryByRole } = render(() => <Counter />, {
wrapper: (props) => {
return (
<Router>
<Route path="/" component={() => <RouteAwareWrapper>{props.children}</RouteAwareWrapper>} />
</Router>
);
},
}); |
Beta Was this translation helpful? Give feedback.
The children of
<Router>
can only be<Route>
components.. Children of<Route>
components can only be<Route>
components. So most of the examples aren't right.I believe is the closest to being correct. I'm gathering
props.children
is a getter that executes the component so it should be inside a page component.You could also do this …