diff --git a/packages/kernel/tests/http-routing.spec.ts b/packages/kernel/tests/http-routing.spec.ts index e8cf86c..b3d4461 100644 --- a/packages/kernel/tests/http-routing.spec.ts +++ b/packages/kernel/tests/http-routing.spec.ts @@ -29,6 +29,21 @@ test("an absolute link navigates the iframe inside the prefix", async ({ page }) expect(frame && new URL(frame.url()).pathname).toBe(`${await appUrl(page)}about`); }); +// A guest document's location is the frame's virtual URL, so its scripts read +// /~/@/http// where the server was asked for /. A client router matches +// that path: React Router hydrates the server-rendered home route into its 404, which +// is why tests/react-router.spec.ts passes only when it reads #hi before hydration. +// Fixing this means choosing how a guest document gets its own path (the shim +// rewriting its URL, or an origin per guest server), so it is recorded, not fixed. +test.fixme("a guest document's location is the path its server was asked for", async ({ page }) => { + await bootServer(page); + const app = page.frameLocator("#app"); + expect(await app.locator(":root").evaluate(() => location.pathname)).toBe("/"); + await app.locator("#about").click(); + await expect(app.locator("#about-h")).toHaveText("About"); + expect(await app.locator(":root").evaluate(() => location.pathname)).toBe("/about"); +}); + test("a form POST to an absolute action keeps its method and body", async ({ page }) => { await bootServer(page); await page.frameLocator("#app").locator("#f button").click();