fix theme navigation and improve project scaffolding
This commit is contained in:
@@ -91,3 +91,16 @@ test("exposes programmatic navigation", async () => {
|
||||
expect(fetchCalls.length).toBe(1);
|
||||
expect(win.document.getElementById("app").innerHTML).toContain("Dashboard");
|
||||
});
|
||||
|
||||
test("rebinds theme controls after swapping the page", async () => {
|
||||
install(`<div id="app"><a href="/about" id="lnk">About</a></div>`);
|
||||
let boundRoot: unknown;
|
||||
win.wireTheme = { bind: (root: unknown) => (boundRoot = root) };
|
||||
nextHtml = `<html><body><div id="app"><button data-wire-theme-toggle>Theme</button></div></body></html>`;
|
||||
|
||||
win.document.getElementById("lnk").click();
|
||||
await flush();
|
||||
|
||||
expect(boundRoot).toBe(win.document);
|
||||
expect(win.document.querySelector("[data-wire-theme-toggle]")).not.toBeNull();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user