import { createRawSnippet } from "svelte"; import { describe, expect, it } from "vitest"; import ActionPanel from "../src/composites/ActionPanel.svelte"; import { actionPanel } from "../src/composites/action-panel.variants"; import TitlingSurfacesConsumer from "./fixtures/TitlingSurfacesConsumer.svelte"; import { expectLayoutReadiness } from "./layout-readiness"; import { classes, classesOf, render, rendered } from "./mount"; const content = createRawSnippet(() => ({ render: () => "
Deployment configuration
" })); const actions = createRawSnippet(() => ({ render: () => '', })); describe("ActionPanel", () => { it("composes one canonical Card with a section heading, body, and associated actions", () => { const panel = rendered( render(ActionPanel, { title: "Production deployment", description: "Review before saving.", children: content, actions, }), ); expect(panel.matches("[data-card][data-action-panel]")).toBe(true); expect(panel.getAttribute("role")).toBe("region"); expect(panel.getAttribute("aria-label")).toBe("Production deployment"); expect(panel.querySelector("[data-section-heading] h2")?.textContent).toBe("Production deployment"); expect(panel.querySelector("[data-card-body]")?.textContent).toContain("Deployment configuration"); expect(panel.querySelectorAll("[data-card-footer] button")).toHaveLength(2); }); it("preserves native action order and focus", () => { const panel = rendered(render(ActionPanel, { title: "Deployment", actions })); const controls = [...panel.querySelectorAll