storybook/docs/snippets/svelte/my-component-play-function-with-delay.js.mdx
2021-10-14 17:15:03 +01:00

27 lines
651 B
Plaintext

```js
// MyComponent.stories.js
import { screen, userEvent } from '@storybook/testing-library';
import MyComponent from './MyComponent.svelte';
export default {
component: MyComponent,
};
export const CombinedStories = {
...FirstStory,
play: async () => {
// The delay option set the ammount of milliseconds between characters being typed
await userEvent.type(screen.getByTestId('example-element'), 'random string', {
delay: 100,
});
await userEvent.type(screen.getByTestId('another-example-element'), 'another random string', {
delay: 100,
});
},
render: () => ({
Component: MyComponent,
}),
};
```