release: WRNexusJS 0.8.2
Quality / quality (ubuntu-latest) (push) Failing after 22s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-03 02:14:54 +05:30
parent 3c6b659f36
commit 4550a11460
84 changed files with 214 additions and 150 deletions
+12
View File
@@ -82,6 +82,18 @@ test("prefetches focused routes once and reuses the document during navigation",
expect(win.document.querySelector("h1")?.textContent).toBe("Prefetched");
});
test("does not prefetch links merely passing under the pointer while scrolling", async () => {
install(`<div id="app"><a href="/about" id="prefetch">About</a></div>`);
const link = win.document.getElementById("prefetch");
link.dispatchEvent(new win.PointerEvent("pointerover", { bubbles: true }));
await flush();
expect(fetchCalls).toHaveLength(0);
link.dispatchEvent(new win.PointerEvent("pointerdown", { bubbles: true }));
await flush();
expect(fetchCalls).toHaveLength(1);
expect(fetchCalls[0]?.opts.headers["x-wrnexus-prefetch"]).toBe("1");
});
test("ignores cross-origin links (full navigation)", async () => {
install(`<div id="app"><a href="https://other.test/x" id="lnk">x</a></div>`);
win.document.getElementById("lnk").click();