@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 20 lines 795 Bytes
Raw
1 import { expect, it } from "vite-plus/test";
2 import { prepareSourceFileDocument, selectableSourceHtml } from "./source-file-document";
3
4 it("preserves source whitespace and markup as literal selectable text", () => {
5 const source = prepareSourceFileDocument(
6 "\n\tlead\r\n<script>alert(1)</script> &amp; > 😀\u00a0end\n",
7 );
8 const html = selectableSourceHtml(source.contents, {
9 foreground: "#000000",
10 selection: "#3366ff",
11 fontSize: 14,
12 rowHeight: 24,
13 wordBreak: true,
14 });
15 const page = new DOMParser().parseFromString(html, "text/html");
16
17 expect(page.querySelector("script")).toBeNull();
18 expect(page.body.textContent).toBe("\n\tlead\n<script>alert(1)</script> &amp; > 😀\u00a0end\n");
19 expect(page.getElementById("L2")?.textContent).toBe("\tlead");
20 });