31 lines
855 B
TypeScript
31 lines
855 B
TypeScript
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
import { expect, userEvent } from 'storybook/test'
|
|
|
|
import { AuthorityRow } from './authority-row'
|
|
|
|
const meta = {
|
|
component: AuthorityRow,
|
|
tags: ['ai-generated'],
|
|
args: {
|
|
kind: 'person',
|
|
lang: 'en',
|
|
authority: { id: 'a1', kind: 'person', external_uri: null, labels: [{ lang: 'en', label: 'Astrid Lindgren' }] },
|
|
},
|
|
} satisfies Meta<typeof AuthorityRow>
|
|
|
|
export default meta
|
|
type Story = StoryObj<typeof meta>
|
|
|
|
export const Display: Story = {
|
|
play: async ({ canvas }) => {
|
|
await expect(canvas.getByText('Astrid Lindgren')).toBeVisible()
|
|
},
|
|
}
|
|
|
|
export const TogglesEdit: Story = {
|
|
play: async ({ canvas }) => {
|
|
await userEvent.click(canvas.getByRole('button', { name: 'Edit' }))
|
|
await expect(canvas.getByRole('button', { name: 'Save' })).toBeVisible()
|
|
},
|
|
}
|