Skip to content

Commit 50d8c62

Browse files
committed
test: 공통 Chip 컴포넌트 스토리북 테스트코드 작성
1 parent f9ccfab commit 50d8c62

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
2+
3+
import Chip from './Chip';
4+
5+
const meta: Meta<typeof Chip> = {
6+
title: 'Shared/UI/Chip',
7+
component: Chip,
8+
parameters: {
9+
layout: 'centered',
10+
},
11+
tags: ['autodocs'],
12+
argTypes: {
13+
variant: {
14+
control: 'radio',
15+
options: ['line', 'fill'],
16+
description: '칩의 스타일 변형',
17+
},
18+
size: {
19+
control: 'radio',
20+
options: ['xs', 'sm', 'md'],
21+
description: '칩의 크기',
22+
},
23+
selected: {
24+
control: 'boolean',
25+
description: '선택 여부',
26+
},
27+
text: {
28+
control: 'text',
29+
description: '표시할 텍스트',
30+
},
31+
},
32+
};
33+
34+
export default meta;
35+
type Story = StoryObj<typeof Chip>;
36+
37+
export const Default: Story = {
38+
args: {
39+
text: 'Chip',
40+
variant: 'line',
41+
size: 'xs',
42+
selected: false,
43+
},
44+
};
45+
46+
export const LineSelected: Story = {
47+
args: {
48+
text: 'Selected Line',
49+
variant: 'line',
50+
size: 'sm',
51+
selected: true,
52+
},
53+
};
54+
55+
export const Fill: Story = {
56+
args: {
57+
text: 'Fill Mode',
58+
variant: 'fill',
59+
size: 'md',
60+
selected: false,
61+
},
62+
};
63+
64+
export const FillSelected: Story = {
65+
args: {
66+
text: 'Selected Fill',
67+
variant: 'fill',
68+
size: 'md',
69+
selected: true,
70+
},
71+
};
72+
73+
export const AllSizes: Story = {
74+
render: (args) => (
75+
<div className='flex flex-col gap-4'>
76+
<div className='flex items-center gap-2'>
77+
<span className='w-10 text-xs text-gray-500'>XS:</span>
78+
<Chip {...args} size='xs' />
79+
</div>
80+
<div className='flex items-center gap-2'>
81+
<span className='w-10 text-xs text-gray-500'>SM:</span>
82+
<Chip {...args} size='sm' />
83+
</div>
84+
<div className='flex items-center gap-2'>
85+
<span className='w-10 text-xs text-gray-500'>MD:</span>
86+
<Chip {...args} size='md' />
87+
</div>
88+
</div>
89+
),
90+
args: {
91+
text: 'Chip Size',
92+
variant: 'line',
93+
selected: false,
94+
},
95+
};

0 commit comments

Comments
 (0)