storybook/docs/snippets/vue/my-component-play-function-query-findby.mdx.mdx
2022-09-14 23:36:07 +01:00

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>
```