feat: support async layout functions (#1597)
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
co-authored by
Asher Gomez
parent
11077227b5
commit
8325225a0d
@@ -64,3 +64,42 @@ Deno.test("check file types", async (t) => {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("render async layout", async () => {
|
||||
await withFresh(
|
||||
"./tests/fixture_layouts/main.ts",
|
||||
async (address) => {
|
||||
const doc = await fetchHtml(`${address}/async`);
|
||||
assertSelector(doc, ".app .root-layout .async-layout .async-page");
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("render nested async layout", async () => {
|
||||
await withFresh(
|
||||
"./tests/fixture_layouts/main.ts",
|
||||
async (address) => {
|
||||
const doc = await fetchHtml(`${address}/async/sub`);
|
||||
assertSelector(
|
||||
doc,
|
||||
".app .root-layout .async-layout .async-sub-layout .async-sub-page",
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "can return Response from async layout",
|
||||
fn: async () => {
|
||||
await withFresh(
|
||||
"./tests/fixture_layouts/main.ts",
|
||||
async (address) => {
|
||||
const doc = await fetchHtml(`${address}/async/redirect`);
|
||||
assertSelector(
|
||||
doc,
|
||||
".app .root-layout .async-layout .async-sub-layout .async-sub-page",
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user