import type { Meta, StoryObj } from "@storybook/react" import { expect, fn, userEvent, within } from "@storybook/test" import { FaCheck } from "react-icons/fa" import type { ButtonLinkProps } from "./Button.tsx" import { Button } from "./Button.tsx" const meta = { title: "Design System/Button", component: Button, tags: ["autodocs"], args: { onClick: fn() }, } satisfies Meta export default meta type Story = StoryObj const ButtonContainer: React.FC = (props) => { const { children } = props return
{children}
} export const Component: Story = { args: { children: "Button", }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement) await userEvent.click(canvas.getByText("Button")) await expect(args.onClick).toHaveBeenCalled() }, } export const Variants: Story = { render: (args) => { return ( ) }, } export const Sizes: Story = { render: (args) => { return ( ) }, } export const Disabled: Story = { render: (args) => { return ( ) }, } export const Loading: Story = { render: (args) => { return ( ) }, } export const Icons: Story = { render: (args) => { return ( ) }, } export const Link: Story = { args: { children: "Link", href: "/", }, play: async ({ canvasElement, args }) => { const canvas = within(canvasElement) await expect( canvas.getByRole("link", { name: "Link", }), ).toHaveAttribute("href", args.href) }, } export const LinkWithIcons: Story = { args: { href: "/", }, render: (args) => { return ( ) }, }