feat: add sheet component and docs qa baseline
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
import { Button } from "@ai-ui/ui";
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
|
||||
function getButtonFromCanvas(canvasElement: HTMLElement, name: string) {
|
||||
const buttons = canvasElement.querySelectorAll("button, a");
|
||||
|
||||
for (const element of buttons) {
|
||||
if (element.textContent?.trim().includes(name)) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Expected to find an interactive control containing "${name}".`);
|
||||
}
|
||||
|
||||
const meta = {
|
||||
title: "Components/Button",
|
||||
component: Button,
|
||||
@@ -61,7 +73,17 @@ export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Playground: Story = {};
|
||||
export const Playground: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const button = getButtonFromCanvas(canvasElement, "Save changes");
|
||||
|
||||
button.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||
|
||||
if (button instanceof HTMLElement) {
|
||||
button.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const Variants: Story = {
|
||||
render: () => (
|
||||
|
||||
Reference in New Issue
Block a user