返回 CodeWhale
terminal-capture.test.ts
根目录 / web / lib / terminal-capture.test.ts
1 import { readFileSync } from "node:fs";
2 import { describe, expect, it } from "vitest";
3 import { TERMINAL_SCREENSHOT } from "./media-manifest";
4 import { RELEASED_CAPTURE_FRAMES } from "./released-capture.generated";
5
6 describe("terminal capture", () => {
7 it("ties the README image to a frame of the real released-capture set", () => {
8 const frame = RELEASED_CAPTURE_FRAMES[TERMINAL_SCREENSHOT.frame];
9 const text = frame.lines.map((runs) => runs.map(([t]) => t).join("")).join("\n");
10 expect(text).toContain(TERMINAL_SCREENSHOT.model);
11 expect(text).toContain("accept edits");
12 });
13
14 it("renders as one labelled image inside a keyboard-scrollable region", () => {
15 const component = readFileSync(new URL("../components/terminal-capture.tsx", import.meta.url), "utf8");
16 expect(component).toContain('role="region"');
17 expect(component).toContain("tabIndex={0}");
18 expect(component).toContain('role="img"');
19 expect(component).toContain('dir="ltr"');
20 expect(component).toContain('lang="en"');
21 expect(component).toContain("aria-label={label}");
22 });
23 });
24
24 lines TYPESCRIPT