import React from "react"; import { expect } from "@storybook/jest"; import { within, userEvent } from "@storybook/testing-library"; import { Button as Button } from "./Button"; import { styled, theme } from "../theme"; import { Icon } from "../icon"; import Asset from "@washingtonpost/wpds-assets/asset/add"; import type { Meta, StoryObj } from "@storybook/react"; const meta: Meta = { title: "Button", component: Button, argTypes: { onClick: { action: "clicked" }, variant: { options: ["primary", "secondary", "cta"], defaultValue: "secondary", }, density: { options: ["compact", "default"], defaultValue: "compact", }, isOutline: { options: [true, false], defaultValue: false, }, icon: { options: ["center", "left", "right", "none"], defaultValue: "none", }, }, args: { children: "Text button", variant: "secondary", density: "compact", isOutline: false, icon: "none", }, }; const Column = styled("div", { display: "flex", flexDirection: "row", gap: "$100", alignItems: "center", marginBlockStart: "$200", }); const Stack = styled("div", { display: "flex", flexDirection: "column", gap: "$100", alignItems: "center", marginBlockStart: "$200", padding: "$100", borderRadius: "$075", }); export default meta; type Story = StoryObj; export const Default: Story = { render: ({ children, ...args }, context) => { return ( <> ); }, }; Default.play = async ({ args, canvasElement }) => { const canvas = within(canvasElement); await userEvent.click(canvas.getByTestId("light-skip-link")); await expect(args.onClick).toHaveBeenCalled(); };