Skip to content

Commit

Permalink
test: 🧪 (<PrefectureStateBar>) 都道府県の選択状態を表示するコンポーネントのストーリーを追加した。 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReoHakase committed May 25, 2024
1 parent 298e8fa commit fd1c218
Showing 1 changed file with 35 additions and 0 deletions.
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');
},
};

0 comments on commit fd1c218

Please sign in to comment.