Add DataTable Storybook coverage

This commit is contained in:
2026-03-19 22:47:23 +08:00
parent 3f77070802
commit 7c87c7af37
3 changed files with 463 additions and 2 deletions
+20
View File
@@ -31,6 +31,26 @@ test("storybook button, select, and reduced-motion form stories stay interactive
await expect(page.locator("pre code").last()).toContainText('"role": "legal"');
});
test("storybook data table story stays interactive", async ({ page }) => {
await page.goto("/iframe.html?id=components-data-table--playground&viewMode=story");
const table = page.getByRole("table", { name: "Routing lanes" });
await expect(table).toBeVisible();
await expect(page.getByRole("searchbox", { name: "Search routing lanes" })).toBeVisible();
const sortableHeader = page.getByRole("columnheader", { name: /owner/i });
await sortableHeader.getByRole("button").click();
await expect(sortableHeader).toHaveAttribute("aria-sort", "ascending");
await page.getByRole("checkbox", { name: /select row/i }).first().click();
await expect(page.getByRole("button", { name: "Clear selection" })).toBeVisible();
const nextButton = page.getByRole("button", { name: "Next" });
await expect(nextButton).toBeEnabled();
await nextButton.click();
await expect(page.getByRole("button", { name: "Previous" })).toBeEnabled();
});
test("storybook overlay stories stay interactive", async ({ page }) => {
await page.goto("/iframe.html?id=components-dialog--playground&viewMode=story");
await page.getByRole("button", { name: "Open approval dialog" }).click();