mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-11 00:06:25 +08:00
32 lines
773 B
Plaintext
32 lines
773 B
Plaintext
```js
|
|
// MyComponent.stories.js
|
|
|
|
import { screen, userEvent } from '@storybook/testing-library';
|
|
|
|
import MyComponent from './MyComponent.vue';
|
|
|
|
export default {
|
|
component: MyComponent,
|
|
};
|
|
|
|
export const DelayedStory = {
|
|
play: async () => {
|
|
|
|
const exampleElement= screen.getByLabelText('example-element');
|
|
|
|
// The delay option set the ammount of milliseconds between characters being typed
|
|
await userEvent.type(exampleElement, 'random string', {
|
|
delay: 100,
|
|
});
|
|
|
|
const AnotherExampleElement= screen.getByLabelText('another-example-element');
|
|
await userEvent.type(AnotherExampleElement, 'another random string', {
|
|
delay: 100,
|
|
});
|
|
},
|
|
render: () => ({
|
|
components: { MyComponent },
|
|
template: '<MyComponent />',
|
|
}),
|
|
};
|
|
``` |