|
1 | 1 | import type { Meta, StoryObj } from '@storybook/react-vite' |
2 | | -import { |
3 | | - Select, |
4 | | - SelectContent, |
5 | | - SelectGroup, |
6 | | - SelectItem, |
7 | | - SelectTrigger, |
8 | | - SelectValue, |
9 | | -} from '../../components/ui/select.tsx' |
10 | | -import { expect, within, userEvent } from 'storybook/test' |
| 2 | +import { Select } from '../../components/select' |
11 | 3 |
|
12 | 4 | const meta: Meta<typeof Select> = { |
13 | 5 | title: 'Components/Select', |
14 | 6 | component: Select, |
15 | 7 | parameters: { |
16 | | - docs: { |
17 | | - description: { |
18 | | - component: 'Displays a list of options for the user to pick from—triggered by a button.', |
19 | | - }, |
20 | | - }, |
21 | 8 | layout: 'centered', |
22 | | - design: { |
23 | | - type: 'figma', |
24 | | - url: 'https://www.figma.com/design/dSsI9L6NSpNCorbSdiYd1k/Oasis-Design-System---shadcn-ui---Default---December-2024?node-id=118-1264&p=f&t=wiAnBZzlnMC9rGYE-0', |
25 | | - }, |
26 | 9 | }, |
27 | 10 | tags: ['autodocs'], |
28 | 11 | } |
29 | 12 |
|
30 | 13 | export default meta |
31 | 14 | type Story = StoryObj<typeof meta> |
32 | 15 |
|
| 16 | +const options = [ |
| 17 | + { value: 'rofl_create', label: 'ROFL Create' }, |
| 18 | + { value: 'rofl_register', label: 'ROFL Register' }, |
| 19 | + { value: 'rofl_remove', label: 'ROFL Remove' }, |
| 20 | + { value: 'rofl_update', label: 'ROFL Update' }, |
| 21 | + { value: '', label: 'Unknown' }, |
| 22 | +] |
| 23 | + |
33 | 24 | export const Default: Story = { |
34 | 25 | args: { |
35 | | - defaultValue: '', |
36 | | - }, |
37 | | - render: args => ( |
38 | | - <Select {...args}> |
39 | | - <SelectTrigger className="w-[180px]"> |
40 | | - <SelectValue placeholder="Select type" /> |
41 | | - </SelectTrigger> |
42 | | - <SelectContent> |
43 | | - <SelectGroup> |
44 | | - <SelectItem value="rofl_create">ROFL Create</SelectItem> |
45 | | - <SelectItem value="rofl_register">ROFL Register</SelectItem> |
46 | | - <SelectItem value="rofl_remove">ROFL Remove</SelectItem> |
47 | | - <SelectItem value="rofl_update">ROFL Update</SelectItem> |
48 | | - </SelectGroup> |
49 | | - </SelectContent> |
50 | | - </Select> |
51 | | - ), |
52 | | - play: async ({ canvasElement }) => { |
53 | | - const canvas = within(canvasElement) |
54 | | - const selectTrigger = canvas.getByRole('combobox') |
55 | | - await expect(selectTrigger).toBeInTheDocument() |
56 | | - await userEvent.click(selectTrigger) |
57 | | - const options = document.querySelectorAll('[role="option"]') |
58 | | - await expect(options).toBeTruthy() |
| 26 | + options, |
| 27 | + placeholder: 'Select type', |
59 | 28 | }, |
60 | 29 | } |
0 commit comments