mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 07:21:16 +08:00
44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
```md
|
|
<!-- RegistrationForm.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 } from '@testing-library/vue';
|
|
|
|
import RegistrationForm from './RegistrationForm.vue';
|
|
|
|
<!-- 👇 Marking the onSubmit with this configuration will log the event in the Actions panel-->
|
|
|
|
<Meta title="RegistrationForm" component={RegistrationForm} argTypes={{ onSubmit: { action: true }}/>
|
|
|
|
<Story
|
|
name="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 submitButton = screen.getByRole('button');
|
|
|
|
await fireEvent.click(submitButton);
|
|
}}
|
|
render={() => ({
|
|
components: { RegistrationForm },
|
|
template: '<RegistrationForm />',
|
|
})} />
|
|
``` |