-
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: 🧪 (
<PrefectureStateBar>
) 都道府県の選択状態を表示するコンポーネントのストーリーを追加した。 (#16)
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
.../web/src/features/navigation/components/PrefectureStateBar/PrefectureStateBar.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,35 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { expect, within } from '@storybook/test'; | ||
import { PrefectureStateBar } from './PrefectureStateBar'; | ||
|
||
type Story = StoryObj<typeof PrefectureStateBar>; | ||
|
||
const meta: Meta<typeof PrefectureStateBar> = { | ||
component: PrefectureStateBar, | ||
tags: ['autodocs'], | ||
parameters: { | ||
nextjs: { | ||
appDirectory: true, | ||
navigation: { | ||
pathname: '/all', | ||
query: { | ||
prefCodes: '8,12,13,14', | ||
}, | ||
}, | ||
}, | ||
}, | ||
argTypes: {}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: Story = { | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
const clearButton = canvas.getByRole('link'); | ||
const heading = canvas.getByRole('heading'); | ||
|
||
expect(heading).toHaveTextContent('4つの都道府県を選択中'); | ||
expect(clearButton.getAttribute('href')).toBe('/all'); | ||
}, | ||
}; |