mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 03:11:49 +08:00
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
```js
|
|
// RegistrationForm.stories.js | RegistrationForm.stories.jsx | RegistrationForm.stories.ts | RegistrationForm.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 { RegistrationForm } from './RegistrationForm.js';
|
|
|
|
export default {
|
|
component: RegistrationForm,
|
|
//👇 Marking the onSubmit with this configuration will log the event in the Actions panel
|
|
argTypes: { onSubmit: { action: true } },
|
|
};
|
|
|
|
export const FilledForm = {
|
|
play: async () => {
|
|
|
|
const emailInput = screen.getByLabelText('email', {
|
|
selector: "input",
|
|
});
|
|
|
|
await userEvent.type(emailInput, 'example-email@email.com', {
|
|
delay: 100,
|
|
});
|
|
|
|
const passwordInput = screen.getByLabelText('password', {
|
|
selector: "input",
|
|
});
|
|
|
|
await userEvent.type(passwordInput, 'ExamplePassword', {
|
|
delay: 100,
|
|
});
|
|
|
|
const Submit = screen.getByRole('button');
|
|
await userEvent.click(Submit);
|
|
},
|
|
};
|
|
``` |