fix: conditionally rendered element under fragment in island does not render (#1172)
This might be fixing #502, but I am not sure. All tests pass. I've added additional test cases for comments from #502 --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
+8
-8
@@ -6,20 +6,20 @@ function createRootFragment(
|
|||||||
replaceNode: Node | Node[],
|
replaceNode: Node | Node[],
|
||||||
) {
|
) {
|
||||||
replaceNode = ([] as Node[]).concat(replaceNode);
|
replaceNode = ([] as Node[]).concat(replaceNode);
|
||||||
const s = replaceNode[replaceNode.length - 1].nextSibling;
|
|
||||||
function insert(c: Node, r: Node) {
|
|
||||||
parent.insertBefore(c, r || s);
|
|
||||||
}
|
|
||||||
// @ts-ignore this is fine
|
// @ts-ignore this is fine
|
||||||
return parent.__k = {
|
return parent.__k = {
|
||||||
nodeType: 1,
|
nodeType: 1,
|
||||||
parentNode: parent,
|
parentNode: parent,
|
||||||
firstChild: replaceNode[0],
|
firstChild: replaceNode[0],
|
||||||
childNodes: replaceNode,
|
childNodes: replaceNode,
|
||||||
insertBefore: insert,
|
insertBefore(node: Node, child: Node) {
|
||||||
appendChild: insert,
|
parent.insertBefore(node, child);
|
||||||
removeChild: function (c: Node) {
|
},
|
||||||
parent.removeChild(c);
|
appendChild(child: Node) {
|
||||||
|
parent.appendChild(child);
|
||||||
|
},
|
||||||
|
removeChild(child: Node) {
|
||||||
|
parent.removeChild(child);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -14,4 +14,7 @@ export {
|
|||||||
} from "https://deno.land/std@0.178.0/streams/text_line_stream.ts";
|
} from "https://deno.land/std@0.178.0/streams/text_line_stream.ts";
|
||||||
export { delay } from "https://deno.land/std@0.178.0/async/delay.ts";
|
export { delay } from "https://deno.land/std@0.178.0/async/delay.ts";
|
||||||
export { retry } from "https://deno.land/std@0.178.0/async/retry.ts";
|
export { retry } from "https://deno.land/std@0.178.0/async/retry.ts";
|
||||||
export { default as puppeteer } from "https://deno.land/x/puppeteer@16.2.0/mod.ts";
|
export {
|
||||||
|
default as puppeteer,
|
||||||
|
Page,
|
||||||
|
} from "https://deno.land/x/puppeteer@16.2.0/mod.ts";
|
||||||
|
|||||||
+38
-30
@@ -18,22 +18,26 @@ import * as $11 from "./routes/index.tsx";
|
|||||||
import * as $12 from "./routes/intercept.tsx";
|
import * as $12 from "./routes/intercept.tsx";
|
||||||
import * as $13 from "./routes/intercept_args.tsx";
|
import * as $13 from "./routes/intercept_args.tsx";
|
||||||
import * as $14 from "./routes/islands/index.tsx";
|
import * as $14 from "./routes/islands/index.tsx";
|
||||||
import * as $15 from "./routes/layeredMdw/_middleware.ts";
|
import * as $15 from "./routes/islands/root_fragment.tsx";
|
||||||
import * as $16 from "./routes/layeredMdw/layer2-no-mw/without_mw.ts";
|
import * as $16 from "./routes/islands/root_fragment_conditional_first.tsx";
|
||||||
import * as $17 from "./routes/layeredMdw/layer2/_middleware.ts";
|
import * as $17 from "./routes/layeredMdw/_middleware.ts";
|
||||||
import * as $18 from "./routes/layeredMdw/layer2/abc.ts";
|
import * as $18 from "./routes/layeredMdw/layer2-no-mw/without_mw.ts";
|
||||||
import * as $19 from "./routes/layeredMdw/layer2/index.ts";
|
import * as $19 from "./routes/layeredMdw/layer2/_middleware.ts";
|
||||||
import * as $20 from "./routes/layeredMdw/layer2/layer3/[id].ts";
|
import * as $20 from "./routes/layeredMdw/layer2/abc.ts";
|
||||||
import * as $21 from "./routes/layeredMdw/layer2/layer3/_middleware.ts";
|
import * as $21 from "./routes/layeredMdw/layer2/index.ts";
|
||||||
import * as $22 from "./routes/middleware_root.ts";
|
import * as $22 from "./routes/layeredMdw/layer2/layer3/[id].ts";
|
||||||
import * as $23 from "./routes/not_found.ts";
|
import * as $23 from "./routes/layeredMdw/layer2/layer3/_middleware.ts";
|
||||||
import * as $24 from "./routes/params.tsx";
|
import * as $24 from "./routes/middleware_root.ts";
|
||||||
import * as $25 from "./routes/props/[id].tsx";
|
import * as $25 from "./routes/not_found.ts";
|
||||||
import * as $26 from "./routes/static.tsx";
|
import * as $26 from "./routes/params.tsx";
|
||||||
import * as $27 from "./routes/wildcard.tsx";
|
import * as $27 from "./routes/props/[id].tsx";
|
||||||
|
import * as $28 from "./routes/static.tsx";
|
||||||
|
import * as $29 from "./routes/wildcard.tsx";
|
||||||
import * as $$0 from "./islands/Counter.tsx";
|
import * as $$0 from "./islands/Counter.tsx";
|
||||||
import * as $$1 from "./islands/Test.tsx";
|
import * as $$1 from "./islands/RootFragment.tsx";
|
||||||
import * as $$2 from "./islands/kebab-case-counter-test.tsx";
|
import * as $$2 from "./islands/RootFragmentWithConditionalFirst.tsx";
|
||||||
|
import * as $$3 from "./islands/Test.tsx";
|
||||||
|
import * as $$4 from "./islands/kebab-case-counter-test.tsx";
|
||||||
|
|
||||||
const manifest = {
|
const manifest = {
|
||||||
routes: {
|
routes: {
|
||||||
@@ -52,24 +56,28 @@ const manifest = {
|
|||||||
"./routes/intercept.tsx": $12,
|
"./routes/intercept.tsx": $12,
|
||||||
"./routes/intercept_args.tsx": $13,
|
"./routes/intercept_args.tsx": $13,
|
||||||
"./routes/islands/index.tsx": $14,
|
"./routes/islands/index.tsx": $14,
|
||||||
"./routes/layeredMdw/_middleware.ts": $15,
|
"./routes/islands/root_fragment.tsx": $15,
|
||||||
"./routes/layeredMdw/layer2-no-mw/without_mw.ts": $16,
|
"./routes/islands/root_fragment_conditional_first.tsx": $16,
|
||||||
"./routes/layeredMdw/layer2/_middleware.ts": $17,
|
"./routes/layeredMdw/_middleware.ts": $17,
|
||||||
"./routes/layeredMdw/layer2/abc.ts": $18,
|
"./routes/layeredMdw/layer2-no-mw/without_mw.ts": $18,
|
||||||
"./routes/layeredMdw/layer2/index.ts": $19,
|
"./routes/layeredMdw/layer2/_middleware.ts": $19,
|
||||||
"./routes/layeredMdw/layer2/layer3/[id].ts": $20,
|
"./routes/layeredMdw/layer2/abc.ts": $20,
|
||||||
"./routes/layeredMdw/layer2/layer3/_middleware.ts": $21,
|
"./routes/layeredMdw/layer2/index.ts": $21,
|
||||||
"./routes/middleware_root.ts": $22,
|
"./routes/layeredMdw/layer2/layer3/[id].ts": $22,
|
||||||
"./routes/not_found.ts": $23,
|
"./routes/layeredMdw/layer2/layer3/_middleware.ts": $23,
|
||||||
"./routes/params.tsx": $24,
|
"./routes/middleware_root.ts": $24,
|
||||||
"./routes/props/[id].tsx": $25,
|
"./routes/not_found.ts": $25,
|
||||||
"./routes/static.tsx": $26,
|
"./routes/params.tsx": $26,
|
||||||
"./routes/wildcard.tsx": $27,
|
"./routes/props/[id].tsx": $27,
|
||||||
|
"./routes/static.tsx": $28,
|
||||||
|
"./routes/wildcard.tsx": $29,
|
||||||
},
|
},
|
||||||
islands: {
|
islands: {
|
||||||
"./islands/Counter.tsx": $$0,
|
"./islands/Counter.tsx": $$0,
|
||||||
"./islands/Test.tsx": $$1,
|
"./islands/RootFragment.tsx": $$1,
|
||||||
"./islands/kebab-case-counter-test.tsx": $$2,
|
"./islands/RootFragmentWithConditionalFirst.tsx": $$2,
|
||||||
|
"./islands/Test.tsx": $$3,
|
||||||
|
"./islands/kebab-case-counter-test.tsx": $$4,
|
||||||
},
|
},
|
||||||
baseUrl: import.meta.url,
|
baseUrl: import.meta.url,
|
||||||
config,
|
config,
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { useState } from "preact/hooks";
|
||||||
|
|
||||||
|
export default function RootFragment() {
|
||||||
|
const [shown, setShown] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
Hello
|
||||||
|
<div onClick={() => setShown(true)} id="root-fragment-click-me">
|
||||||
|
World
|
||||||
|
</div>
|
||||||
|
{shown && <div>I'm rendered now</div>}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { useState } from "preact/hooks";
|
||||||
|
|
||||||
|
export default function RootFragmentWithConditionalFirst() {
|
||||||
|
const [shown, setShown] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{shown && <div>I'm rendered on top</div>}
|
||||||
|
Hello
|
||||||
|
<div
|
||||||
|
onClick={() => setShown(true)}
|
||||||
|
id="root-fragment-conditional-first-click-me"
|
||||||
|
>
|
||||||
|
World
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import RootFragment from "../../islands/RootFragment.tsx";
|
||||||
|
|
||||||
|
export default function Home() {
|
||||||
|
return (
|
||||||
|
<div id="island-parent">
|
||||||
|
<RootFragment />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import RootFragmentWithConditionalFirst from "../../islands/RootFragmentWithConditionalFirst.tsx";
|
||||||
|
|
||||||
|
export default function Home() {
|
||||||
|
return (
|
||||||
|
<div id="island-parent">
|
||||||
|
<RootFragmentWithConditionalFirst />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
+170
-104
@@ -2,6 +2,7 @@ import {
|
|||||||
assert,
|
assert,
|
||||||
assertStringIncludes,
|
assertStringIncludes,
|
||||||
delay,
|
delay,
|
||||||
|
Page,
|
||||||
puppeteer,
|
puppeteer,
|
||||||
TextLineStream,
|
TextLineStream,
|
||||||
} from "./deps.ts";
|
} from "./deps.ts";
|
||||||
@@ -9,133 +10,198 @@ import {
|
|||||||
Deno.test({
|
Deno.test({
|
||||||
name: "island tests",
|
name: "island tests",
|
||||||
async fn(t) {
|
async fn(t) {
|
||||||
// Preparation
|
await withPage(async (page) => {
|
||||||
const serverProcess = new Deno.Command(Deno.execPath(), {
|
async function counterTest(counterId: string, originalValue: number) {
|
||||||
args: ["run", "-A", "./tests/fixture/main.ts"],
|
const pElem = await page.waitForSelector(`#${counterId} > p`);
|
||||||
stdout: "piped",
|
|
||||||
stderr: "inherit",
|
|
||||||
}).spawn();
|
|
||||||
|
|
||||||
const decoder = new TextDecoderStream();
|
let value = await pElem?.evaluate((el) => el.textContent);
|
||||||
const lines = serverProcess.stdout
|
assert(value === `${originalValue}`, `${counterId} first value`);
|
||||||
.pipeThrough(decoder)
|
|
||||||
.pipeThrough(new TextLineStream());
|
|
||||||
|
|
||||||
let started = false;
|
const buttonPlus = await page.$(`#b-${counterId}`);
|
||||||
for await (const line of lines) {
|
await buttonPlus?.click();
|
||||||
if (line.includes("Listening on http://")) {
|
|
||||||
started = true;
|
await delay(100);
|
||||||
break;
|
|
||||||
|
value = await pElem?.evaluate((el) => el.textContent);
|
||||||
|
assert(value === `${originalValue + 1}`, `${counterId} click`);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!started) {
|
await page.goto("http://localhost:8000/islands", {
|
||||||
|
waitUntil: "networkidle2",
|
||||||
|
});
|
||||||
|
|
||||||
|
await t.step("Ensure 3 islands on 1 page are revived", async () => {
|
||||||
|
await counterTest("counter1", 3);
|
||||||
|
await counterTest("counter2", 10);
|
||||||
|
await counterTest("kebab-case-file-counter", 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
await t.step("Ensure an island revive an img 'hash' path", async () => {
|
||||||
|
// Ensure src path has __frsh_c=
|
||||||
|
const pElem = await page.waitForSelector(`#img-in-island`);
|
||||||
|
const srcString = (await pElem?.getProperty("src"))?.toString()!;
|
||||||
|
assertStringIncludes(srcString, "image.png?__frsh_c=");
|
||||||
|
|
||||||
|
// Ensure src path is the same as server rendered
|
||||||
|
const resp = await fetch(new Request("http://localhost:8000/islands"));
|
||||||
|
const body = await resp.text();
|
||||||
|
|
||||||
|
const imgFilePath = body.match(/img id="img-in-island" src="(.*?)"/)
|
||||||
|
?.[1]!;
|
||||||
|
assertStringIncludes(srcString, imgFilePath);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
sanitizeOps: false,
|
||||||
|
sanitizeResources: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
async function withPage(fn: (page: Page) => Promise<void>) {
|
||||||
|
const serverProcess = new Deno.Command(Deno.execPath(), {
|
||||||
|
args: ["run", "-A", "./tests/fixture/main.ts"],
|
||||||
|
stdout: "piped",
|
||||||
|
stderr: "inherit",
|
||||||
|
}).spawn();
|
||||||
|
|
||||||
|
const textDecoderStream = new TextDecoderStream();
|
||||||
|
const textLineStream = new TextLineStream();
|
||||||
|
|
||||||
|
const lines = serverProcess.stdout
|
||||||
|
.pipeThrough(textDecoderStream)
|
||||||
|
.pipeThrough(textLineStream);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!await didServerStart(lines)) {
|
||||||
throw new Error("Server didn't start up");
|
throw new Error("Server didn't start up");
|
||||||
}
|
}
|
||||||
|
|
||||||
await delay(100);
|
await delay(100);
|
||||||
|
|
||||||
const browser = await puppeteer.launch({ args: ["--no-sandbox"] });
|
const browser = await puppeteer.launch({ args: ["--no-sandbox"] });
|
||||||
const page = await browser.newPage();
|
|
||||||
|
|
||||||
async function counterTest(counterId: string, originalValue: number) {
|
try {
|
||||||
const pElem = await page.waitForSelector(`#${counterId} > p`);
|
const page = await browser.newPage();
|
||||||
let value = await pElem?.evaluate((el) => el.textContent);
|
await fn(page);
|
||||||
assert(value === `${originalValue}`, `${counterId} first value`);
|
} finally {
|
||||||
|
await browser.close();
|
||||||
const buttonPlus = await page.$(`#b-${counterId}`);
|
|
||||||
await buttonPlus?.click();
|
|
||||||
await delay(100);
|
|
||||||
value = await pElem?.evaluate((el) => el.textContent);
|
|
||||||
assert(value === `${originalValue + 1}`, `${counterId} click`);
|
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
await page.goto("http://localhost:8000/islands", {
|
|
||||||
waitUntil: "networkidle2",
|
|
||||||
});
|
|
||||||
|
|
||||||
await t.step("Ensure 3 islands on 1 page are revived", async () => {
|
|
||||||
await counterTest("counter1", 3);
|
|
||||||
await counterTest("counter2", 10);
|
|
||||||
await counterTest("kebab-case-file-counter", 5);
|
|
||||||
});
|
|
||||||
|
|
||||||
await t.step("Ensure an island revive an img 'hash' path", async () => {
|
|
||||||
// Ensure src path has __frsh_c=
|
|
||||||
const pElem = await page.waitForSelector(`#img-in-island`);
|
|
||||||
const srcString = (await pElem?.getProperty("src"))?.toString()!;
|
|
||||||
assertStringIncludes(srcString, "image.png?__frsh_c=");
|
|
||||||
|
|
||||||
// Ensure src path is the same as server rendered
|
|
||||||
const resp = await fetch(new Request("http://localhost:8000/islands"));
|
|
||||||
const body = await resp.text();
|
|
||||||
const imgFilePath = body.match(/img id="img-in-island" src="(.*?)"/)
|
|
||||||
?.[1]!;
|
|
||||||
assertStringIncludes(srcString, imgFilePath);
|
|
||||||
});
|
|
||||||
|
|
||||||
await browser.close();
|
|
||||||
|
|
||||||
await lines.cancel();
|
await lines.cancel();
|
||||||
|
|
||||||
serverProcess.kill("SIGTERM");
|
serverProcess.kill("SIGTERM");
|
||||||
|
|
||||||
|
// Wait until the process exits
|
||||||
|
await serverProcess.status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function didServerStart(
|
||||||
|
stdoutLines: ReadableStream<string>,
|
||||||
|
): Promise<boolean> {
|
||||||
|
for await (const line of stdoutLines) {
|
||||||
|
if (line.includes("Listening on http://")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "island tests with </script>",
|
||||||
|
|
||||||
|
async fn(t) {
|
||||||
|
await withPage(async (page) => {
|
||||||
|
page.on("dialog", () => {
|
||||||
|
assert(false, "There is XSS");
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto("http://localhost:8000/evil", {
|
||||||
|
waitUntil: "networkidle2",
|
||||||
|
});
|
||||||
|
|
||||||
|
await t.step("prevent XSS on Island", async () => {
|
||||||
|
const bodyElem = await page.waitForSelector(`body`);
|
||||||
|
const value = await bodyElem?.evaluate((el) => el.getInnerHTML());
|
||||||
|
|
||||||
|
assertStringIncludes(
|
||||||
|
value,
|
||||||
|
`{"message":"\\u003c/script\\u003e\\u003cscript\\u003ealert('test')\\u003c/script\\u003e"}`,
|
||||||
|
`XSS is not escaped`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
sanitizeOps: false,
|
sanitizeOps: false,
|
||||||
sanitizeResources: false,
|
sanitizeResources: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
name: "island tests with </script>",
|
name: "island with fragment as root",
|
||||||
async fn(t) {
|
|
||||||
// Preparation
|
|
||||||
const serverProcess = new Deno.Command(Deno.execPath(), {
|
|
||||||
args: ["run", "-A", "./tests/fixture/main.ts"],
|
|
||||||
stdout: "piped",
|
|
||||||
stderr: "inherit",
|
|
||||||
}).spawn();
|
|
||||||
|
|
||||||
const decoder = new TextDecoderStream();
|
async fn(_t) {
|
||||||
const lines = serverProcess.stdout
|
await withPage(async (page) => {
|
||||||
.pipeThrough(decoder)
|
await page.goto("http://localhost:8000/islands/root_fragment", {
|
||||||
.pipeThrough(new TextLineStream());
|
waitUntil: "networkidle2",
|
||||||
|
});
|
||||||
|
|
||||||
let started = false;
|
const clickableSelector = "#root-fragment-click-me";
|
||||||
for await (const line of lines) {
|
|
||||||
if (line.includes("Listening on http://")) {
|
await page.waitForSelector(clickableSelector);
|
||||||
started = true;
|
|
||||||
break;
|
const contentBeforeClick = await getIslandParentTextContent();
|
||||||
|
assert(contentBeforeClick === "HelloWorld");
|
||||||
|
|
||||||
|
await page.click(clickableSelector);
|
||||||
|
await delay(100);
|
||||||
|
|
||||||
|
const contentAfterClick = await getIslandParentTextContent();
|
||||||
|
assert(contentAfterClick === "HelloWorldI'm rendered now");
|
||||||
|
|
||||||
|
async function getIslandParentTextContent() {
|
||||||
|
return await page.$eval(
|
||||||
|
"#island-parent",
|
||||||
|
(el: Element) => el.textContent,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!started) {
|
|
||||||
throw new Error("Server didn't start up");
|
|
||||||
}
|
|
||||||
|
|
||||||
await delay(100);
|
|
||||||
|
|
||||||
const browser = await puppeteer.launch({ args: ["--no-sandbox"] });
|
|
||||||
const page = await browser.newPage();
|
|
||||||
page.on("dialog", () => {
|
|
||||||
assert(false, "There is XSS");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.goto("http://localhost:8000/evil", {
|
|
||||||
waitUntil: "networkidle2",
|
|
||||||
});
|
|
||||||
|
|
||||||
await t.step("prevent XSS on Island", async () => {
|
|
||||||
const bodyElem = await page.waitForSelector(`body`);
|
|
||||||
const value = await bodyElem?.evaluate((el) => el.getInnerHTML());
|
|
||||||
|
|
||||||
assertStringIncludes(
|
|
||||||
value,
|
|
||||||
`{"message":"\\u003c/script\\u003e\\u003cscript\\u003ealert('test')\\u003c/script\\u003e"}`,
|
|
||||||
`XSS is not escaped`,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
await browser.close();
|
|
||||||
|
|
||||||
await lines.cancel();
|
|
||||||
serverProcess.kill("SIGTERM");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
sanitizeOps: false,
|
sanitizeOps: false,
|
||||||
sanitizeResources: false,
|
sanitizeResources: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "island with fragment as root and conditional child first",
|
||||||
|
|
||||||
|
async fn(_t) {
|
||||||
|
await withPage(async (page) => {
|
||||||
|
await page.goto(
|
||||||
|
"http://localhost:8000/islands/root_fragment_conditional_first",
|
||||||
|
{
|
||||||
|
waitUntil: "networkidle2",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const clickableSelector = "#root-fragment-conditional-first-click-me";
|
||||||
|
await page.waitForSelector(clickableSelector);
|
||||||
|
|
||||||
|
const contentBeforeClick = await getIslandParentTextContent(page);
|
||||||
|
assert(contentBeforeClick === "HelloWorld");
|
||||||
|
|
||||||
|
await page.click(clickableSelector);
|
||||||
|
await delay(100);
|
||||||
|
|
||||||
|
const contentAfterClick = await getIslandParentTextContent(page);
|
||||||
|
assert(contentAfterClick === "I'm rendered on topHelloWorld");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
sanitizeOps: false,
|
||||||
|
sanitizeResources: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
async function getIslandParentTextContent(page: Page) {
|
||||||
|
return await page.$eval("#island-parent", (el: Element) => el.textContent);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user