diff options
| author | Adam Malczewski <[email protected]> | 2026-06-27 01:13:28 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-27 01:13:31 +0900 |
| commit | 2fa03f8d7410c2b8d6be8e10ad088863e83d7177 (patch) | |
| tree | 94e1923180ae38d571d34b578afecb0a18913c24 /src/components/Table.test.ts | |
| parent | 80f99665034a0e510300793205c162fc7a46769f (diff) | |
| parent | 08b12478636f4a5c86a1f3c40a843f2906b7c82f (diff) | |
| download | dispatch-web-2fa03f8d7410c2b8d6be8e10ad088863e83d7177.tar.gz dispatch-web-2fa03f8d7410c2b8d6be8e10ad088863e83d7177.zip | |
Merge branch 'dev' into feature/heartbeat
# Conflicts:
# src/app/App.svelte
# src/app/store.svelte.ts
# src/app/store.test.ts
# src/features/workspaces/ui/WorkspaceCard.test.ts
Diffstat (limited to 'src/components/Table.test.ts')
| -rw-r--r-- | src/components/Table.test.ts | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/components/Table.test.ts b/src/components/Table.test.ts index 9fbecd3..f43a981 100644 --- a/src/components/Table.test.ts +++ b/src/components/Table.test.ts @@ -3,33 +3,33 @@ import { describe, expect, it } from "vitest"; import Table from "./Table.svelte"; describe("Table", () => { - it("renders a header cell per column", () => { - render(Table, { props: { columns: ["Name", "Version"], rows: [] } }); - const headers = screen.getAllByRole("columnheader"); - expect(headers.map((h) => h.textContent)).toEqual(["Name", "Version"]); - }); + it("renders a header cell per column", () => { + render(Table, { props: { columns: ["Name", "Version"], rows: [] } }); + const headers = screen.getAllByRole("columnheader"); + expect(headers.map((h) => h.textContent)).toEqual(["Name", "Version"]); + }); - it("renders one row per data row with aligned cells", () => { - render(Table, { - props: { - columns: ["Name", "Version"], - rows: [ - ["alpha", "1.0"], - ["beta", "2.3"], - ], - }, - }); - const body = screen.getAllByRole("rowgroup")[1]; - if (body === undefined) throw new Error("expected a tbody rowgroup"); - const rows = within(body).getAllByRole("row"); - expect(rows).toHaveLength(2); - expect(within(rows[0] as HTMLElement).getByText("alpha")).toBeInTheDocument(); - expect(within(rows[0] as HTMLElement).getByText("1.0")).toBeInTheDocument(); - expect(within(rows[1] as HTMLElement).getByText("beta")).toBeInTheDocument(); - }); + it("renders one row per data row with aligned cells", () => { + render(Table, { + props: { + columns: ["Name", "Version"], + rows: [ + ["alpha", "1.0"], + ["beta", "2.3"], + ], + }, + }); + const body = screen.getAllByRole("rowgroup")[1]; + if (body === undefined) throw new Error("expected a tbody rowgroup"); + const rows = within(body).getAllByRole("row"); + expect(rows).toHaveLength(2); + expect(within(rows[0] as HTMLElement).getByText("alpha")).toBeInTheDocument(); + expect(within(rows[0] as HTMLElement).getByText("1.0")).toBeInTheDocument(); + expect(within(rows[1] as HTMLElement).getByText("beta")).toBeInTheDocument(); + }); - it("shows the empty message when there are no rows", () => { - render(Table, { props: { columns: ["A"], rows: [], empty: "Nothing loaded" } }); - expect(screen.getByText("Nothing loaded")).toBeInTheDocument(); - }); + it("shows the empty message when there are no rows", () => { + render(Table, { props: { columns: ["A"], rows: [], empty: "Nothing loaded" } }); + expect(screen.getByText("Nothing loaded")).toBeInTheDocument(); + }); }); |
