| 123456789101112131415161718192021222324252627 |
- import { createElement } from "react";
- import { renderToStaticMarkup } from "react-dom/server";
- import { describe, expect, it } from "vitest";
- import { ReadFileChip, type ReadSummary } from "@/ToolCallBlocks/renderers/read.js";
- const summary: ReadSummary = {
- path: "/workspace/src/App.tsx",
- fileName: "App.tsx",
- filePath: "/workspace/src/",
- fileIconSrc: "/material-icons/typescript.svg",
- entryType: "file",
- };
- describe("ReadFileChip", () => {
- it.each([false, true])("uses the subtle filename color (clickable=%s)", (clickable) => {
- const html = renderToStaticMarkup(
- createElement(ReadFileChip, {
- summary,
- clickable,
- onClick: clickable ? () => undefined : undefined,
- }),
- );
- expect(html).toContain("text-foreground-subtle");
- expect(html).not.toMatch(/(?:^|\s)text-foreground(?:\s|$)/u);
- });
- });
|