fix: address Storybook review findings
This commit is contained in:
parent
d95f064189
commit
17c9d24e31
8 changed files with 121 additions and 20 deletions
|
|
@ -1,7 +1,9 @@
|
|||
import { render } from "svelte/server";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import Button from "./Button.svelte";
|
||||
import DashboardFrame from "./DashboardFrame.svelte";
|
||||
import FooterCell from "./FooterCell.svelte";
|
||||
import IconButton from "./IconButton.svelte";
|
||||
import ServiceRow from "./ServiceRow.svelte";
|
||||
import TelemetryCard from "./TelemetryCard.svelte";
|
||||
import { dashboardPreviewFixtures } from "../fixtures";
|
||||
|
|
@ -94,4 +96,31 @@ describe("dashboard UI components", () => {
|
|||
expect(withoutProgress.body).not.toContain("telemetry-card__bar");
|
||||
expect(withProgress.body).toContain("--metric-progress: 42%");
|
||||
});
|
||||
|
||||
test("base button controls forward native attributes", () => {
|
||||
const button = render(Button, {
|
||||
props: {
|
||||
label: "Refresh",
|
||||
id: "refresh-action",
|
||||
class: "custom-action",
|
||||
"aria-controls": "refresh-target",
|
||||
},
|
||||
});
|
||||
const iconButton = render(IconButton, {
|
||||
props: {
|
||||
icon: "mdi:refresh",
|
||||
label: "Refresh status",
|
||||
id: "refresh-icon-action",
|
||||
class: "custom-icon-action",
|
||||
"aria-expanded": "false",
|
||||
},
|
||||
});
|
||||
|
||||
expect(button.body).toContain("id=\"refresh-action\"");
|
||||
expect(button.body).toContain("class=\"ui-button custom-action ");
|
||||
expect(button.body).toContain("aria-controls=\"refresh-target\"");
|
||||
expect(iconButton.body).toContain("id=\"refresh-icon-action\"");
|
||||
expect(iconButton.body).toContain("class=\"icon-button custom-icon-action ");
|
||||
expect(iconButton.body).toContain("aria-expanded=\"false\"");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue