Skip to content

Commit ea9c57e

Browse files
committed
Update test
1 parent 2702938 commit ea9c57e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

chartlets.js/packages/lib/src/plugins/mui/Table.test.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ describe("Table", () => {
1818
rows={mockRows}
1919
type="Table"
2020
id="tableId"
21+
ariaLabel="Test Table"
2122
onChange={() => {}}
2223
paginationModel={paginationModel}
2324
pageSizeOptions={[10, 25, 50]}
2425
/>,
2526
);
2627
expect(screen.getByRole("grid")).toBeInTheDocument();
2728
expect(screen.getByText("MockRow")).toBeInTheDocument();
29+
30+
const grid = screen.getByTestId("data-grid-test-id");
31+
expect(grid).toHaveAttribute("aria-label", "Test Table");
2832
});
2933

3034
it("should handle row click", () => {
@@ -65,10 +69,19 @@ describe("Table", () => {
6569
loading={true}
6670
/>,
6771
);
68-
expect(screen.getByTestId("data-grid-test-id")).toHaveAttribute(
69-
"aria-label",
70-
"Test Table",
71-
);
72+
73+
const gridRole = screen.getByTestId("data-grid-test-id");
74+
75+
// Check density
76+
expect(gridRole).toHaveClass("MuiDataGrid-root--densityCompact");
77+
78+
// Check loading
79+
expect(screen.getByRole("progressbar")).toBeInTheDocument();
80+
81+
// Check checkboxSelection
82+
expect(
83+
screen.getByRole("columnheader", { name: /select/i }),
84+
).toBeInTheDocument();
7285
});
7386

7487
it("should not render if no columns are provided", () => {

0 commit comments

Comments
 (0)