mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
32 lines
741 B
Plaintext
32 lines
741 B
Plaintext
```md
|
|
<!-- MyComponent.stories.mdx -->
|
|
|
|
import { Meta, Story } from '@storybook/addon-docs';
|
|
|
|
<!--These are placeholders until the addon-interaction is out -->
|
|
|
|
import userEvent from '@testing-library/user-event';
|
|
import { screen, fireEvent } from '@testing-library/svelte';
|
|
|
|
import MyComponent from './MyComponent.svelte';
|
|
|
|
<Meta title="ClickExamples" component={MyComponent} />
|
|
|
|
<Story
|
|
name="ClickExample"
|
|
play={async () => {
|
|
await userEvent.click(screen.getByTestId('data-testid'));
|
|
}}
|
|
render={() => ({
|
|
Component: MyComponent,
|
|
})} />
|
|
|
|
<Story
|
|
name="FireEventExample"
|
|
play={async () => {
|
|
await fireEvent.click(screen.getByTestId('data-testid'));
|
|
}}
|
|
render={() => ({
|
|
Component: MyComponent,
|
|
})} />
|
|
``` |