storybook/docs/snippets/svelte/my-component-play-function-with-clickevent.js.mdx
2021-10-05 02:08:12 +01:00

31 lines
663 B
Plaintext

```js
// MyComponent.stories.js
// 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';
export default {
component: MyComponent,
};
export const ClickExample = {
play: async () => {
await userEvent.click(screen.getByTestId('data-testid'));
},
render: () => ({
Component: MyComponent,
}),
};
export const FireEventExample = {
play: async () => {
await fireEvent.click(screen.getByTestId('data-testid'));
},
render: () => ({
Component: MyComponent,
}),
};
```