-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 🧪 (
<PrefectureCheckboxFieldset>
) 都道府県をフェッチしてチェックボックスを表示するコンポー…
…ネントのストーリーを追加した。 (#20)
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...s/navigation/components/PrefectureCheckboxFieldset/PrefectureCheckboxFieldset.stories.tsx
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,43 @@ | ||
import { action } from '@storybook/addon-actions'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { expect, fn, within } from '@storybook/test'; | ||
import { PrefectureCheckboxFieldset } from './PrefectureCheckboxFieldset'; | ||
|
||
type Story = StoryObj<typeof PrefectureCheckboxFieldset>; | ||
|
||
const meta: Meta<typeof PrefectureCheckboxFieldset> = { | ||
component: PrefectureCheckboxFieldset, | ||
tags: ['autodocs'], | ||
parameters: { | ||
nextjs: { | ||
appDirectory: true, | ||
navigation: { | ||
push: fn(async (...args: unknown[]) => action('nextRouter.push')(...args)), | ||
pathname: '/all', | ||
query: { | ||
prefCodes: '11,24', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: Story = { | ||
parameters: { | ||
nextjs: { | ||
navigation: { | ||
query: { | ||
prefCodes: '8,12,13,14', | ||
}, | ||
}, | ||
}, | ||
}, | ||
play: async ({ canvasElement }) => { | ||
// TODO: RESAS APIからのレスポンスをモックする | ||
const canvas = within(canvasElement); | ||
const checkboxes = await canvas.findAllByRole('checkbox'); | ||
expect(checkboxes).toHaveLength(47); | ||
}, | ||
}; |