storybook/docs/snippets/vue/portable-stories-vitest-with-play-function.ts.mdx
2024-03-05 17:59:34 +01:00

19 lines
444 B
Plaintext

```ts
// Button.test.ts
import { test } from 'vitest';
import { render } from '@testing-library/vue';
import { composeStory } from '@storybook/vue3';
import meta, { Primary } from './Button.stories';
test('renders and executes the play function', async () => {
const PrimaryStory = composeStory(Primary, meta);
// First, render the story
render(PrimaryStory);
// Then, execute the play function
await PrimaryStory.play();
});
```