Skip to content
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

window.history.pushState not working as expected #158

Open
saravntbe opened this issue Sep 26, 2022 · 2 comments · May be fixed by #179
Open

window.history.pushState not working as expected #158

saravntbe opened this issue Sep 26, 2022 · 2 comments · May be fixed by #179
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@saravntbe
Copy link

window.history.pushState not working as expected when jest-location-mock is used.
clone this repo to reproduce.
example (below test fails.)

test('route should be changed', ()=>{
     window.history.pushState({}, 'Test page', '/123')
     expect(window.location.href).toEqual('https://localhost/123')
 })
@evelynhathaway evelynhathaway added the enhancement New feature or request label Sep 29, 2022
@evelynhathaway
Copy link
Owner

Currently, this project only mocks window.location and not the history or navigation APIs. This would be a good future feature 😸

@evelynhathaway
Copy link
Owner

After digging more into #123, it looks like your issue is also a bug with how JSDOM has limited window.history support, and this mock replaces it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
2 participants