char-slop/berry

multipurpose self-modifiable agentic harness

git clone https://git.t4t.associates/char-slop/berry

Charlotte Somdiff: add (codemirror) inline editing of diffsc5dd844

main
924 B24 linesraw
1import { assertEquals } from "@std/assert";
2import { withDom } from "@berry/util/dom.ts";
3import { syncRenderers } from "./renderers.ts";
4
5Deno.test("a frontend whose styles alone changed swaps its stylesheets without importing it again", () =>
6  withDom(async () => {
7    const module = `data:text/javascript,${encodeURIComponent("export default { tools: {} };")}`;
8    const hrefs = () =>
9      [...document.head.querySelectorAll("link")].map((link) => link.getAttribute("href"));
10    try {
11      assertEquals(
12        await syncRenderers([{ name: "probe", formerly: [], web: { module, styles: ["/a.css"] } }]),
13        true,
14      );
15      assertEquals(hrefs(), ["/a.css"]);
16      assertEquals(
17        await syncRenderers([{ name: "probe", formerly: [], web: { module, styles: ["/b.css"] } }]),
18        false,
19      );
20      assertEquals(hrefs(), ["/b.css"]);
21    } finally {
22      await syncRenderers([]);
23    }
24  }));