Files
yaak-mountain-loop/packages/ui/src/components/Table.test.tsx
T
Gregory SchierandClaude Opus 5.5 700003e9a2 Compact CSV tables, and stop dimming empty tabs in Yaak Proxy
The shared Table gains a density prop; the CSV viewer uses compact,
bringing its rows from about 38px to about 25px with the header to
match. Every other table keeps its spacing.

The proxy no longer reads empty tabs in the subtlest colour: every
inactive tab label is one colour and the count badge alone says a tab
has content. dimEmptyTabs leaves both shared panes and the empty option
leaves Tabs, since nothing else used them. The harness gains a TSV
fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 10:52:36 -07:00

44 lines
1.3 KiB
TypeScript

import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, test } from "vite-plus/test";
import { Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow } from "./Table";
import { CsvViewerInner } from "./viewers/CsvViewer";
function table(density?: "default" | "compact") {
return renderToStaticMarkup(
<Table density={density}>
<TableHead>
<TableRow>
<TableHeaderCell>Name</TableHeaderCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell>Accept</TableCell>
</TableRow>
</TableBody>
</Table>,
);
}
describe("Table density", () => {
test("a compact table trims its cells' and header's padding", () => {
const markup = table("compact");
expect(markup).toContain('data-density="compact"');
expect(markup).toContain("[&amp;_td]:py-0.5");
expect(markup).toContain("[&amp;_th]:py-0.5");
});
test("other tables keep their spacing", () => {
const markup = table();
expect(markup).toContain('data-density="default"');
expect(markup).not.toContain("py-0.5");
expect(markup).toContain("py-2");
});
test("the CSV viewer's table is compact", () => {
expect(renderToStaticMarkup(<CsvViewerInner text={"a,b\n1,2"} />)).toContain(
'data-density="compact"',
);
});
});