Pre Release New Changes
This commit is contained in:
@@ -126,3 +126,24 @@ test("unmounts and remounts package runtimes during client navigation", async ()
|
||||
expect(mounts).toBe(1);
|
||||
expect(win.document.getElementById("app").textContent).toContain("New");
|
||||
});
|
||||
|
||||
test("synchronizes page styles during client navigation and preserves the current nonce", async () => {
|
||||
install(
|
||||
`<script nonce="current-nonce"></script>` +
|
||||
`<style data-wrnexus-style-id="home" data-wrnexus-style-kind="page" nonce="current-nonce">.page{color:red}</style>` +
|
||||
`<div id="app"><a href="/about" id="lnk">About</a></div>`,
|
||||
);
|
||||
nextHtml =
|
||||
`<html><head>` +
|
||||
`<style data-wrnexus-style-id="about" data-wrnexus-style-owner="About" data-wrnexus-style-kind="page" nonce="response-nonce">.page{color:blue}</style>` +
|
||||
`</head><body><div id="app"><h1 class="page">About</h1></div></body></html>`;
|
||||
|
||||
win.document.getElementById("lnk").click();
|
||||
await flush();
|
||||
|
||||
expect(win.document.querySelector('style[data-wrnexus-style-id="home"]')).toBeNull();
|
||||
const style = win.document.querySelector('style[data-wrnexus-style-id="about"]');
|
||||
expect(style).not.toBeNull();
|
||||
expect(style.textContent).toContain("color:blue");
|
||||
expect(style.getAttribute("nonce")).toBe("current-nonce");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user