fix(server): sanitize brackets from island names (#1723)
This commit is contained in:
@@ -2,8 +2,11 @@ import { assert } from "./deps.ts";
|
||||
import {
|
||||
assertNotSelector,
|
||||
assertSelector,
|
||||
clickWhenListenerReady,
|
||||
fetchHtml,
|
||||
waitForText,
|
||||
withFresh,
|
||||
withPageName,
|
||||
} from "./test_utils.ts";
|
||||
|
||||
Deno.test("apply root _layout and _app", async () => {
|
||||
@@ -160,3 +163,38 @@ Deno.test("route overrides layout and app", async () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "island in dynamic route test",
|
||||
async fn(t) {
|
||||
await withPageName(
|
||||
"./tests/fixture_layouts/main.ts",
|
||||
async (page, address) => {
|
||||
async function counterTest(counterId: string, originalValue: number) {
|
||||
const pElem = await page.waitForSelector(`#${counterId} > p`);
|
||||
|
||||
const value = await pElem?.evaluate((el) => el.textContent);
|
||||
assert(value === `${originalValue}`, `${counterId} first value`);
|
||||
|
||||
await clickWhenListenerReady(page, `#b-${counterId}`);
|
||||
await waitForText(
|
||||
page,
|
||||
`#${counterId} > p`,
|
||||
String(originalValue + 1),
|
||||
);
|
||||
}
|
||||
|
||||
await page.goto(`${address}/dynamic/acme-corp`, {
|
||||
waitUntil: "networkidle2",
|
||||
});
|
||||
|
||||
await t.step("Ensure 1 island on 1 page are revived", async () => {
|
||||
await counterTest("counter", 3);
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
sanitizeOps: false,
|
||||
sanitizeResources: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user