UNPKG

@patternslib/patternslib

Version:

Patternslib is a JavaScript library that enables designers to build rich interactive prototypes without the need for writing any Javascript. All events are triggered by classes and other attributes in the HTML, without abusing the HTML as a programming la

35 lines (24 loc) 892 B
import "./polyfills"; describe("NavigateEvent tests", () => { afterEach(() => { document.body.innerHTML = ""; }); it("should fire an event when history.pushState is called.", () => { let destination_url; window.navigation.addEventListener("navigate", (event) => { destination_url = event.destination.url; }); const path = "foo/bar/baz.html"; history.pushState(null, "", path); expect(destination_url).toBe(path); }); it("should fire an event when history.replaceState is called.", () => { let destination_url; window.navigation.addEventListener("navigate", (event) => { destination_url = event.destination.url; }); const path = "foo/bar/baz.html"; history.replaceState(null, "", path); expect(destination_url).toBe(path); }); });