mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
27 lines
620 B
Plaintext
27 lines
620 B
Plaintext
```md
|
|
<!-- MyComponent.stories.mdx -->
|
|
|
|
import { Meta, Story } from '@storybook/addon-docs';
|
|
|
|
import { screen, userEvent } from '@storybook/testing-library';
|
|
|
|
import MyComponent from './MyComponent.vue';
|
|
|
|
<Meta title="Async Query Methods" component={MyComponent} />
|
|
|
|
export const Template = () => ({
|
|
components: { MyComponent },
|
|
template: '<MyComponent />',
|
|
});
|
|
|
|
<Story
|
|
name="AsyncExample"
|
|
play={async () => {
|
|
// Other steps
|
|
|
|
// Waits for the component to be rendered before querying the element
|
|
await screen.findByRole('button', { name: / button label/i }));
|
|
}}>
|
|
{Template.bind({})}
|
|
</Story>
|
|
``` |