Testing with new Solid Router. #361
Replies: 3 comments
-
Could you use the Memory Router for tests? It allows you to inject your own History manager as well to control where it goes. The does only use the URL bar in the client, I made it isomorphic by detecting client server and using Static Router on server which does use the URL directly. Static Router is another option here I suppose. |
Beta Was this translation helpful? Give feedback.
-
Thanks, it seems that we don't have enough docs for Normally when testing, I render the whole |
Beta Was this translation helpful? Give feedback.
-
Yes replace Like: // create history
const fauxHistory = createMemoryHistory();
// do stuff with it:
fauxHistory.set({ value: "/" }) // go to some url
// plug it into the router.
<MemoryRouter history={fauxHistory} /> |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
There are 2 related questions regarding using Solid Router in test.
Where I can pass in
source
to test different pages.With the new Solid Router, I wasn't be able to do something similar, even though I tried to use
url
Router doesn't pick up url, but rather only take the url from the address bar.
Cheers,
Your Example Website or App
I tried to put some code into playground but somehow cannot add @solidjs/router as dependency.
Steps to Reproduce the Bug or Issue
N/A
Expected behavior
N/A
Screenshots or Videos
No response
Platform
N/A
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions