mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-10 00:12:22 +08:00
29 lines
725 B
Plaintext
29 lines
725 B
Plaintext
```js
|
|
// MyComponent.stories.js
|
|
|
|
import { screen, userEvent } from '@storybook/testing-library';
|
|
|
|
import MyComponent from './MyComponent.svelte';
|
|
|
|
export default {
|
|
/* 👇 The title prop is optional.
|
|
* See https://storybook.js.org/docs/svelte/configure/overview#configure-story-loading
|
|
* to learn how to generate automatic titles
|
|
*/
|
|
title: 'Async Query Methods',
|
|
component: MyComponent,
|
|
};
|
|
|
|
const Template = (args) => ({
|
|
Component: MyComponent,
|
|
props: args,
|
|
});
|
|
|
|
export const AsyncExample = Template.bind({});
|
|
AsyncExample.play = async () => {
|
|
// Other steps
|
|
|
|
// Waits for the component to be rendered before querying the element
|
|
await screen.findByRole('button', { name: / button label/i }));
|
|
};
|
|
``` |