-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
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
Breaking: Integrate with window.history
, add setter method on window.location
, improve tests and other project meta
#179
base: main
Are you sure you want to change the base?
Conversation
… to the original window.location
…ion methods to readme
src/hooks/replace-history.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is where are majority of the net new value is.
We "replace" the history with a proxy to automatically update after any method is called. I could have made this an equally hacky replacement of each method with a spy that composes itself with an update function, but proxies are fun. (I wish Jest spies had events)
Jest spies on the methods on the proxy to provide access to call data to testers.
set (value: string) { | ||
locationMock.href = value; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't implement the setter on the first go of this library. Mostly because I don't use it instead of the many other options like window.location.href =
and forgot! TypeScript's typings are also borked here, so maybe I am not alone lol.
This is technically a breaking change, so I am glad it can be lumped together with window.history
support
## v3.0.0-alpha.1 **[`v2.0.0...v3.0.0-alpha.1`](v2.0.0...v3.0.0-alpha.1)** - **2023-10-20** ### 💥 Breaking - Add setter method on window.location [`4be68a0`](4be68a0) - Add spies and proxy for window.history to track its updates to the original window.location [`628a60d`](628a60d) ### 📄 Documentation - Add limitations, new features, alternative setup and configuration methods to readme [`51a65bf`](51a65bf) - Fix comma typos in readme [`8f9af49`](8f9af49) ### 📦 Package - **npm:** Bump jest-diff from 29.6.4 to 29.7.0 [`d592844`](d592844) - **npm:** npm update deep [`26652b8`](26652b8) ### 🧹 Internal - Downgrade semantic-release [`774ada3`](774ada3) - Improve tests for existing logic [`8ef5de8`](8ef5de8) - Remove extraneous eslint disables [`e3401af`](e3401af) - Simplify GitHub Actions npm cache [`0a0441c`](0a0441c) - Update GitHub Actions [`ed50b4d`](ed50b4d)
jsdom v23.1.0 has changed the |
Breaking
Improvements
Internal
Chore: Simplify GitHub Actions npm cache
Chore: Remove extraneous eslint disables
Chore: Improve tests for existing logic