feat: co-locate islands + non-route files (#1600)

This commit is contained in:
Marvin Hagemeister
2023-08-07 20:33:08 +02:00
committed by GitHub
parent d8211dad28
commit 97c6876bf7
9 changed files with 171 additions and 67 deletions
+42 -1
View File
@@ -1,4 +1,11 @@
import { assertTextMany, fetchHtml, withFresh } from "./test_utils.ts";
import { assertEquals } from "$std/testing/asserts.ts";
import {
assertTextMany,
fetchHtml,
waitForText,
withFresh,
withPageName,
} from "./test_utils.ts";
Deno.test("applies only _layout file of one group", async () => {
await withFresh(
@@ -30,3 +37,37 @@ Deno.test("applies only _layout files in parent groups #2", async () => {
},
);
});
Deno.test("can co-locate islands inside routes folder", async () => {
await withPageName(
"./tests/fixture/main.ts",
async (page, address) => {
await page.goto(`${address}/route-groups-islands/`);
await page.waitForSelector("button");
await page.click("button");
await waitForText(page, "p", "1");
},
);
});
Deno.test("does not treat files in (_islands) as routes", async () => {
await withFresh(
"./tests/fixture/main.ts",
async (address) => {
const res = await fetch(`${address}/route-groups-islands/invalid`);
assertEquals(res.status, 404);
res.body?.cancel();
},
);
});
Deno.test("does not treat files in (_...) as routes", async () => {
await withFresh(
"./tests/fixture/main.ts",
async (address) => {
const res = await fetch(`${address}/route-groups-islands/sub`);
assertEquals(res.status, 404);
res.body?.cancel();
},
);
});