mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-17 22:21:26 +01:00
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>
44 lines
1.3 KiB
TypeScript
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("[&_td]:py-0.5");
|
|
expect(markup).toContain("[&_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"',
|
|
);
|
|
});
|
|
});
|