fix: falsy f-* attributes not preserved inside island (#2498)
Fixes https://github.com/denoland/fresh/issues/2359
This commit is contained in:
@@ -29,6 +29,7 @@ import * as path from "@std/path";
|
||||
import { setBuildCache } from "../src/app.ts";
|
||||
import { getBuildCache } from "../src/app.ts";
|
||||
import type { FreshConfig } from "../src/config.ts";
|
||||
import { FreshAttrs } from "./fixtures_islands/FreshAttrs.tsx";
|
||||
|
||||
await buildProd(allIslandApp);
|
||||
|
||||
@@ -601,6 +602,36 @@ Deno.test({
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "islands - preserve f-* attributes",
|
||||
fn: async () => {
|
||||
const freshAttrs = getIsland("FreshAttrs.tsx");
|
||||
|
||||
const app = testApp()
|
||||
.use(staticFiles())
|
||||
.island(freshAttrs, "FreshAttrs", FreshAttrs)
|
||||
.get("/", (ctx) =>
|
||||
ctx.render(
|
||||
<Doc>
|
||||
<FreshAttrs />
|
||||
</Doc>,
|
||||
));
|
||||
|
||||
await withBrowserApp(app, async (page, address) => {
|
||||
await page.goto(address, { waitUntil: "load" });
|
||||
await page.locator(".ready").wait();
|
||||
|
||||
const truthy = await page.locator<HTMLDivElement>(".f-client-nav-true")
|
||||
.evaluate((el) => el.getAttribute("f-client-nav"));
|
||||
const falsy = await page.locator<HTMLDivElement>(".f-client-nav-false")
|
||||
.evaluate((el) => el.getAttribute("f-client-nav"));
|
||||
|
||||
expect(truthy).toEqual("true");
|
||||
expect(falsy).toEqual("false");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "fsRoutes - load islands from group folder",
|
||||
fn: async () => {
|
||||
|
||||
Reference in New Issue
Block a user