We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using vitest to run the tests it doesnt load the query parameters
create a story and show the query param create a play function that looks for the query param the test will fail
The query param should be loaded
The text was updated successfully, but these errors were encountered:
ive solved it by using the logic inside the beforeEach:
beforeEach: async ({ parameters, mount, canvasElement }) => { const { location } = document; if (parameters.query) { const currentQuery = new URLSearchParams(location.search); const additionalQuery = typeof parameters.query === "string" ? new URLSearchParams(parameters.query) : parameters.query; const newLocation = new URL(document.location.href); newLocation.search = new URLSearchParams({ ...currentQuery, ...additionalQuery, }).toString(); history.replaceState({}, document.title, newLocation.toString()); } return () => { // reset query search params: history.replaceState({}, document.title, location.toString()); }; }, } satisfies Preview;
Sorry, something went wrong.
No branches or pull requests
Describe the bug
When using vitest to run the tests it doesnt load the query parameters
Steps to reproduce the behavior
create a story and show the query param
create a play function that looks for the query param
the test will fail
Expected behavior
The query param should be loaded
The text was updated successfully, but these errors were encountered: