This repository was archived by the owner on Mar 12, 2023. It is now read-only.
Replies: 1 comment 4 replies
-
|
Hey @kwiat1990, doing a rerender with different initialLoaderData I don't think is the right approach as the loaderData is stored in React state by Remix, so a rerender isn't going to cause the loader data to update. You would need to trigger a transition by submitting a form or navigating, to cause the state to be updated, but this can be tricky with jsdom. If you just want to test the rendering of ThemeToggler for each theme then I'd do that using render in two separate tests. Otherwise the button should submit a form and Remix should update the loader data from the mock loader method. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @jrestall referencing your response from this thread remix-run/remix#2481 (reply in thread), I would like this discussion to not spam the Remix thread.
I've updated
createRemixStubwith your changes and the test below still has problems with reactivity of react's context:My first approach was to use user event and to fire a click to change the theme (instead this line
rerender(<RemixStub initialLoaderData={{ "/": { theme: Theme.DARK } }} />)) as it's was the component make in real life, but it also didn't work.My stup for this test look following:
Beta Was this translation helpful? Give feedback.
All reactions