release: WRNexusJS 0.4.0
This commit is contained in:
@@ -104,3 +104,25 @@ test("rebinds theme controls after swapping the page", async () => {
|
||||
expect(boundRoot).toBe(win.document);
|
||||
expect(win.document.querySelector("[data-wire-theme-toggle]")).not.toBeNull();
|
||||
});
|
||||
|
||||
test("unmounts and remounts package runtimes during client navigation", async () => {
|
||||
install(
|
||||
`<div id="app"><div data-wrnexus-runtime="captcha">Old</div><a href="/next" id="lnk">Next</a></div>`,
|
||||
);
|
||||
let mounts = 0;
|
||||
let unmounts = 0;
|
||||
win.__wrnexusRuntimes = {
|
||||
captcha: {
|
||||
mount: () => mounts++,
|
||||
unmount: () => unmounts++,
|
||||
},
|
||||
};
|
||||
nextHtml = `<html><body><div id="app"><div data-wrnexus-runtime="captcha">New</div></div></body></html>`;
|
||||
|
||||
win.document.getElementById("lnk").click();
|
||||
await flush();
|
||||
|
||||
expect(unmounts).toBe(1);
|
||||
expect(mounts).toBe(1);
|
||||
expect(win.document.getElementById("app").textContent).toContain("New");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user