Skip to content

Instantly share code, notes, and snippets.

@shawn-sandy
Created December 3, 2022 18:39
Show Gist options
  • Save shawn-sandy/ceed325f35c497a7c8282919ae8bca86 to your computer and use it in GitHub Desktop.
Save shawn-sandy/ceed325f35c497a7c8282919ae8bca86 to your computer and use it in GitHub Desktop.
import { Button } from './button'
import { BADGE } from '@geometricpanda/storybook-addon-badges'
import '@shawnsandy/first-paint/dist/css/components/button.min.css'
import { userEvent, screen, waitFor } from '@storybook/testing-library'
import { expect } from '@storybook/jest'
export default {
title: 'FP.React Components/Buttons',
component: Button,
args: {
children: 'Default Button',
type: 'button',
},
argTypes: {
children: { control: 'text' },
onPointerDown: { action: 'down' },
onPointerLeave: { action: 'leave' },
onPointerOver: { action: 'over' },
},
parameters: {
badges: [BADGE.BETA],
docs: {
description: {
component: 'A headless button component',
},
},
},
}
export const Default = {}
export const Primary = {
args: {
children: 'Primary Button',
type: 'submit',
},
play: async () => {
// const canvas = within(canvasElement)
const button = screen.getByRole('button')
expect(button).toBeInTheDocument()
expect(button).toHaveAccessibleName(/primary button/i)
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment