mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 09:31:47 +08:00
28 lines
752 B
Plaintext
28 lines
752 B
Plaintext
```md
|
|
<!-- MyComponent.stories.mdx -->
|
|
|
|
import { Meta, Story } from '@storybook/addon-docs';
|
|
|
|
<!-- These are placeholders until the addon-interaction is out -->
|
|
|
|
import { screen } from '@testing-library/react';
|
|
|
|
import userEvent from '@testing-library/user-event';
|
|
|
|
import { MyComponent } from './MyComponent.js';
|
|
|
|
<Meta title="WithDelay" component={MyComponent} />
|
|
|
|
<!-- The delay option sets the amount of milliseconds between characters being typed-->
|
|
|
|
<Story
|
|
name="DelayedStory"
|
|
play={async () => {
|
|
await userEvent.type(screen.getByTestId('example-element'), 'random string', {
|
|
delay: 100,
|
|
});
|
|
await userEvent.type(screen.getByTestId('another-example-element'), 'another random string', {
|
|
delay: 100,
|
|
});
|
|
}} />
|
|
``` |