mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
26 lines
755 B
Plaintext
26 lines
755 B
Plaintext
```js
|
|
// MyComponent.stories.js | MyComponent.stories.jsx | MyComponent.stories.ts | MyComponent.stories.tsx
|
|
|
|
// 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';
|
|
|
|
export default {
|
|
component: MyComponent,
|
|
};
|
|
|
|
export const DelayedStory = {
|
|
play: async () => {
|
|
// The delay option sets the amount 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,
|
|
});
|
|
},
|
|
};
|
|
``` |