Skip to content
Advertisement

Tag: browser-history

React Testing with history passed

Problem Statement I’m using create react app with Jest. In my test, I simply want to render out a component that needs history passed to the state before it can load. I’ve been researching and trying to get to this to work for awhile. The source I’ve been using shows how to pass the history to the router – https://testing-library.com/docs/example-react-router/

How to get notified about changes of the history via history.pushState?

So now that HTML5 introduces history.pushState to change the browsers history, websites start using this in combination with Ajax instead of changing the fragment identifier of the URL. Sadly that means that those calls cannot be detect anymore by onhashchange. My question is: Is there a reliable way (hack? ;)) to detect when a website uses history.pushState? The specification does

Advertisement