feat(web): set up Storybook (preview + MSW + stories for real components)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite'
|
||||
import { expect } from 'storybook/test'
|
||||
|
||||
import { Button } from './button'
|
||||
|
||||
const meta = {
|
||||
component: Button,
|
||||
tags: ['ai-generated'],
|
||||
} satisfies Meta<typeof Button>
|
||||
|
||||
export default meta
|
||||
type Story = StoryObj<typeof meta>
|
||||
|
||||
export const Default: Story = {
|
||||
args: { children: 'Save' },
|
||||
play: async ({ canvas }) => {
|
||||
const button = canvas.getByRole('button', { name: /save/i })
|
||||
await expect(button).toHaveAttribute('data-slot', 'button')
|
||||
},
|
||||
}
|
||||
|
||||
export const Outline: Story = {
|
||||
args: { variant: 'outline', children: 'Cancel' },
|
||||
}
|
||||
|
||||
export const Destructive: Story = {
|
||||
args: { variant: 'destructive', children: 'Delete' },
|
||||
}
|
||||
|
||||
export const Disabled: Story = {
|
||||
args: { children: 'Save', disabled: true },
|
||||
play: async ({ canvas }) => {
|
||||
await expect(canvas.getByRole('button', { name: /save/i })).toBeDisabled()
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user