This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from storybookjs/default-decorate-story
Support Storybook 7.0
- Loading branch information
Showing
16 changed files
with
10,529 additions
and
16,679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Branch structure | ||
|
||
- **next** - the `next` version on npm, and the development branch where most work occurs | ||
- **prerelease** - the `prerelease` version on npm, where eventual changes to `main` get tested | ||
- **main** - the `latest` version on npm and the stable version that most users use | ||
|
||
## Release process | ||
|
||
1. All PRs should target the `next` branch, which depends on the `next` version of Storybook. | ||
2. When merged, a new version of this package will be released on the `next` NPM tag. | ||
3. If the change contains a bugfix that needs to be patched back to the stable version, please note that in PR description. | ||
4. PRs labeled `pick` will get cherry-picked back to the `prerelease` branch and will generate a release on the `prerelease` npm tag. | ||
5. Once validated, `prerelease` PRs will get merged back to the `main` branch, which will generate a release on the `latest` npm tag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { setGlobalConfig } from '../dist/index'; | ||
import { setProjectAnnotations } from '../dist/index'; | ||
import * as globalStorybookConfig from './.storybook/preview'; | ||
|
||
setGlobalConfig(globalStorybookConfig); | ||
setProjectAnnotations(globalStorybookConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import React from 'react'; | ||
import type { ComponentMeta, ComponentStoryObj } from '@storybook/react'; | ||
import { screen } from '@testing-library/dom'; | ||
import userEvent from '@testing-library/user-event'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { within, userEvent} from '@storybook/testing-library'; | ||
|
||
import { AccountForm, AccountFormProps } from './AccountForm'; | ||
|
||
export default { | ||
const meta = { | ||
title: 'CSF3/AccountForm', | ||
component: AccountForm, | ||
parameters: { | ||
|
@@ -15,43 +14,53 @@ export default { | |
<p>This uses a custom render from meta</p> | ||
<AccountForm {...args} /> | ||
</div>) | ||
} as ComponentMeta<typeof AccountForm>; | ||
} as Meta<typeof AccountForm>; | ||
|
||
type Story = ComponentStoryObj<typeof AccountForm> | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Standard: Story = { | ||
args: { passwordVerification: false }, | ||
}; | ||
|
||
export const StandardEmailFilled: Story = { | ||
...Standard, | ||
play: () => userEvent.type(screen.getByTestId('email'), '[email protected]'), | ||
play: async ({canvasElement}) => { | ||
const canvas = within(canvasElement); | ||
await userEvent.type(canvas.getByTestId('email'), '[email protected]'); | ||
} | ||
}; | ||
|
||
export const StandardEmailFailed: Story = { | ||
...Standard, | ||
play: async () => { | ||
await userEvent.type(screen.getByTestId('email'), '[email protected]@com'); | ||
await userEvent.type(screen.getByTestId('password1'), 'testpasswordthatwontfail'); | ||
await userEvent.click(screen.getByTestId('submit')); | ||
play: async ({canvasElement}) => { | ||
const canvas = within(canvasElement); | ||
await userEvent.type(canvas.getByTestId('email'), '[email protected]@com'); | ||
await userEvent.type(canvas.getByTestId('password1'), 'testpasswordthatwontfail'); | ||
await userEvent.click(canvas.getByTestId('submit')); | ||
}, | ||
}; | ||
|
||
export const StandardPasswordFailed: Story = { | ||
...Standard, | ||
play: async (context) => { | ||
const {canvasElement} = context; | ||
const canvas = within(canvasElement); | ||
await StandardEmailFilled.play!(context); | ||
await userEvent.type(screen.getByTestId('password1'), 'asdf'); | ||
await userEvent.click(screen.getByTestId('submit')); | ||
await userEvent.type(canvas.getByTestId('password1'), 'asdf'); | ||
await userEvent.click(canvas.getByTestId('submit')); | ||
}, | ||
}; | ||
|
||
export const StandardFailHover: Story = { | ||
...StandardPasswordFailed, | ||
play: async (context) => { | ||
const {canvasElement} = context; | ||
const canvas = within(canvasElement); | ||
await StandardPasswordFailed.play!(context); | ||
await sleep(100); | ||
await userEvent.hover(screen.getByTestId('password-error-info')); | ||
await userEvent.hover(canvas.getByTestId('password-error-info')); | ||
}, | ||
}; | ||
|
||
|
@@ -62,19 +71,23 @@ export const Verification: Story = { | |
export const VerificationPasssword1: Story = { | ||
...Verification, | ||
play: async (context) => { | ||
const {canvasElement} = context; | ||
const canvas = within(canvasElement); | ||
await StandardEmailFilled.play!(context); | ||
await userEvent.type(screen.getByTestId('password1'), 'asdfasdf'); | ||
await userEvent.click(screen.getByTestId('submit')); | ||
await userEvent.type(canvas.getByTestId('password1'), 'asdfasdf'); | ||
await userEvent.click(canvas.getByTestId('submit')); | ||
}, | ||
}; | ||
|
||
export const VerificationPasswordMismatch: Story = { | ||
...Verification, | ||
play: async (context) => { | ||
const {canvasElement} = context; | ||
const canvas = within(canvasElement); | ||
await StandardEmailFilled.play!(context); | ||
await userEvent.type(screen.getByTestId('password1'), 'asdfasdf'); | ||
await userEvent.type(screen.getByTestId('password2'), 'asdf1234'); | ||
await userEvent.click(screen.getByTestId('submit')); | ||
await userEvent.type(canvas.getByTestId('password1'), 'asdfasdf'); | ||
await userEvent.type(canvas.getByTestId('password2'), 'asdf1234'); | ||
await userEvent.click(canvas.getByTestId('submit')); | ||
}, | ||
}; | ||
|
||
|
@@ -83,13 +96,15 @@ const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); | |
export const VerificationSuccess: Story = { | ||
...Verification, | ||
play: async (context) => { | ||
const {canvasElement} = context; | ||
const canvas = within(canvasElement); | ||
await StandardEmailFilled.play!(context); | ||
await sleep(1000); | ||
await userEvent.type(screen.getByTestId('password1'), 'asdfasdf', { delay: 50 }); | ||
await userEvent.type(canvas.getByTestId('password1'), 'asdfasdf', { delay: 50 }); | ||
await sleep(1000); | ||
await userEvent.type(screen.getByTestId('password2'), 'asdfasdf', { delay: 50 }); | ||
await userEvent.type(canvas.getByTestId('password2'), 'asdfasdf', { delay: 50 }); | ||
await sleep(1000); | ||
await userEvent.click(screen.getByTestId('submit')); | ||
await userEvent.click(canvas.getByTestId('submit')); | ||
}, | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,6 @@ | |
"noEmit": true | ||
}, | ||
"include": [ | ||
"src" | ||
"src", "../../dist" | ||
] | ||
} |
Oops, something went wrong.