summaryrefslogtreecommitdiffhomepage
path: root/src/components/Table.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-26 22:21:55 +0900
committerAdam Malczewski <[email protected]>2026-06-26 22:23:39 +0900
commitc333fcec32b1f90bf0da6bb14d2609c20e38a74f (patch)
tree0db3ec77a6838c4f800c362df0de3c6cd8544431 /src/components/Table.test.ts
parent1285564f12238b22f6b39b9f3fbcecaca8456911 (diff)
downloaddispatch-web-c333fcec32b1f90bf0da6bb14d2609c20e38a74f.tar.gz
dispatch-web-c333fcec32b1f90bf0da6bb14d2609c20e38a74f.zip
style: switch from tabs to 2-space indentation (incl. svelte)
Diffstat (limited to 'src/components/Table.test.ts')
-rw-r--r--src/components/Table.test.ts54
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();
+ });
});