mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 09:22:09 +08:00
29 lines
756 B
Plaintext
29 lines
756 B
Plaintext
```md
|
|
<!-- MyComponent.stories.mdx -->
|
|
|
|
import { Meta, Story } from '@storybook/addon-docs';
|
|
|
|
import { screen, userEvent } from '@storybook/testing-library';
|
|
|
|
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 () => {
|
|
const exampleElement= screen.getByLabelText('example-element');
|
|
|
|
await userEvent.type(exampleElement, 'random string', {
|
|
delay: 100,
|
|
});
|
|
|
|
const AnotherExampleElement= screen.getByLabelText('another-example-element');
|
|
|
|
await userEvent.type(AnotherExampleElement, 'another random string', {
|
|
delay: 100,
|
|
});
|
|
}} />
|
|
``` |