reshaped 3.8.0-canary.2 → 3.8.0-canary.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +2 -1
- package/dist/bundle.js +11 -11
- package/dist/components/Accordion/AccordionControlled.js +1 -0
- package/dist/components/Actionable/Actionable.js +17 -3
- package/dist/components/Actionable/Actionable.module.css +1 -1
- package/dist/components/Actionable/Actionable.types.d.ts +15 -3
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +13 -1
- package/dist/components/Actionable/tests/Actionable.stories.js +127 -7
- package/dist/components/Alert/tests/Alert.stories.d.ts +6 -5
- package/dist/components/Alert/tests/Alert.stories.js +15 -2
- package/dist/components/Autocomplete/Autocomplete.js +2 -2
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +1 -1
- package/dist/components/Badge/Badge.module.css +1 -1
- package/dist/components/Badge/tests/Badge.stories.d.ts +5 -0
- package/dist/components/Badge/tests/Badge.stories.js +34 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -0
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +8 -4
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +57 -1
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Button/Button.types.d.ts +1 -1
- package/dist/components/Button/tests/Button.stories.d.ts +54 -12
- package/dist/components/Button/tests/Button.stories.js +725 -588
- package/dist/components/Calendar/CalendarMonth.js +1 -0
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.module.css +1 -1
- package/dist/components/Card/tests/Card.stories.d.ts +29 -7
- package/dist/components/Card/tests/Card.stories.js +110 -65
- package/dist/components/Carousel/Carousel.js +1 -0
- package/dist/components/Carousel/Carousel.module.css +1 -1
- package/dist/components/Checkbox/Checkbox.module.css +1 -1
- package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +20 -4
- package/dist/components/Checkbox/tests/Checkbox.stories.js +150 -79
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +9 -2
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +67 -35
- package/dist/components/Container/tests/Container.stories.d.ts +2 -0
- package/dist/components/Container/tests/Container.stories.js +14 -0
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +10 -1
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +57 -13
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +5 -0
- package/dist/components/Dismissible/tests/Dismissible.stories.js +30 -1
- package/dist/components/Divider/tests/Divider.stories.d.ts +8 -3
- package/dist/components/Divider/tests/Divider.stories.js +71 -41
- package/dist/components/DropdownMenu/DropdownMenu.js +4 -4
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +2 -2
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +35 -6
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +222 -115
- package/dist/components/FileUpload/FileUpload.module.css +1 -1
- package/dist/components/Flyout/Flyout.module.css +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +7 -7
- package/dist/components/Flyout/FlyoutContent.js +4 -1
- package/dist/components/Flyout/FlyoutControlled.js +10 -3
- package/dist/components/Flyout/index.d.ts +1 -1
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +8 -0
- package/dist/components/Flyout/tests/Flyout.stories.js +81 -33
- package/dist/components/Flyout/useFlyout.d.ts +1 -7
- package/dist/components/Flyout/useFlyout.js +5 -1
- package/dist/components/Flyout/utilities/calculatePosition.d.ts +3 -2
- package/dist/components/Flyout/utilities/calculatePosition.js +47 -22
- package/dist/components/Flyout/utilities/flyout.js +3 -2
- package/dist/components/Flyout/utilities/getPositionFallbacks.js +3 -3
- package/dist/components/Flyout/utilities/isFullyVisible.d.ts +0 -2
- package/dist/components/Flyout/utilities/isFullyVisible.js +5 -7
- package/dist/components/FormControl/FormControl.context.d.ts +1 -1
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +2 -0
- package/dist/components/FormControl/tests/FormControl.stories.js +35 -0
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +2 -0
- package/dist/components/Hidden/tests/Hidden.stories.js +9 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +2 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +9 -0
- package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +2 -0
- package/dist/components/Hotkey/tests/Hotkey.stories.js +15 -0
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/Icon/Icon.types.d.ts +1 -1
- package/dist/components/Icon/tests/Icon.stories.d.ts +3 -0
- package/dist/components/Icon/tests/Icon.stories.js +29 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.js +2 -2
- package/dist/components/Link/Link.types.d.ts +1 -1
- package/dist/components/Link/tests/Link.stories.d.ts +29 -6
- package/dist/components/Link/tests/Link.stories.js +141 -58
- package/dist/components/Loader/tests/Loader.stories.d.ts +11 -2
- package/dist/components/Loader/tests/Loader.stories.js +52 -25
- package/dist/components/MenuItem/MenuItem.js +2 -2
- package/dist/components/MenuItem/MenuItem.module.css +1 -1
- package/dist/components/MenuItem/MenuItem.types.d.ts +1 -1
- package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +37 -7
- package/dist/components/MenuItem/tests/MenuItem.stories.js +218 -112
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/Modal.module.css +1 -1
- package/dist/components/Modal/tests/Modal.stories.d.ts +49 -10
- package/dist/components/Modal/tests/Modal.stories.js +350 -210
- package/dist/components/Overlay/Overlay.js +2 -1
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +15 -1
- package/dist/components/Overlay/tests/Overlay.stories.js +135 -1
- package/dist/components/Pagination/tests/Pagination.stories.d.ts +14 -1
- package/dist/components/Pagination/tests/Pagination.stories.js +93 -15
- package/dist/components/PinField/tests/PinField.stories.d.ts +1 -1
- package/dist/components/PinField/tests/PinField.stories.js +1 -1
- package/dist/components/Popover/Popover.js +2 -2
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +3 -1
- package/dist/components/Progress/tests/Progress.stories.d.ts +19 -4
- package/dist/components/Progress/tests/Progress.stories.js +85 -49
- package/dist/components/Radio/Radio.module.css +1 -1
- package/dist/components/Radio/tests/Radio.stories.d.ts +25 -4
- package/dist/components/Radio/tests/Radio.stories.js +147 -65
- package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +9 -2
- package/dist/components/RadioGroup/tests/RadioGroup.stories.js +64 -38
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/Scrim/tests/Scrim.stories.d.ts +10 -2
- package/dist/components/Scrim/tests/Scrim.stories.js +51 -31
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/Select/Select.d.ts +8 -1
- package/dist/components/Select/Select.js +22 -48
- package/dist/components/Select/Select.module.css +1 -1
- package/dist/components/Select/Select.types.d.ts +83 -38
- package/dist/components/Select/SelectCustom.d.ts +3 -0
- package/dist/components/Select/SelectCustom.js +12 -0
- package/dist/components/Select/SelectCustomControlled.d.ts +4 -0
- package/dist/components/Select/SelectCustomControlled.js +105 -0
- package/dist/components/Select/SelectCustomUncontrolled.d.ts +4 -0
- package/dist/components/Select/SelectCustomUncontrolled.js +18 -0
- package/dist/components/Select/SelectEndContent.d.ts +3 -0
- package/dist/components/Select/SelectEndContent.js +12 -0
- package/dist/components/Select/SelectNative.d.ts +4 -0
- package/dist/components/Select/SelectNative.js +29 -0
- package/dist/components/Select/SelectOption.d.ts +4 -0
- package/dist/components/Select/SelectOption.js +13 -0
- package/dist/components/Select/SelectOptionGroup.d.ts +4 -0
- package/dist/components/Select/SelectOptionGroup.js +9 -0
- package/dist/components/Select/SelectRoot.d.ts +4 -0
- package/dist/components/Select/SelectRoot.js +21 -0
- package/dist/components/Select/SelectStartContent.d.ts +3 -0
- package/dist/components/Select/SelectStartContent.js +20 -0
- package/dist/components/Select/SelectTrigger.d.ts +4 -0
- package/dist/components/Select/SelectTrigger.js +16 -0
- package/dist/components/Select/tests/Select.stories.d.ts +38 -10
- package/dist/components/Select/tests/Select.stories.js +504 -175
- package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +10 -2
- package/dist/components/Skeleton/tests/Skeleton.stories.js +46 -28
- package/dist/components/Slider/Slider.module.css +1 -1
- package/dist/components/Stepper/Stepper.js +2 -2
- package/dist/components/Stepper/Stepper.types.d.ts +2 -0
- package/dist/components/Stepper/tests/Stepper.stories.d.ts +18 -3
- package/dist/components/Stepper/tests/Stepper.stories.js +99 -47
- package/dist/components/Switch/Switch.module.css +1 -1
- package/dist/components/Switch/tests/Switch.stories.d.ts +10 -2
- package/dist/components/Switch/tests/Switch.stories.js +77 -23
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -10
- package/dist/components/Switch/tests/Switch.test.stories.js +0 -68
- package/dist/components/Table/Table.js +5 -3
- package/dist/components/Table/Table.module.css +1 -1
- package/dist/components/Table/tests/Table.stories.d.ts +25 -5
- package/dist/components/Table/tests/Table.stories.js +274 -177
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/TabsControlled.js +1 -0
- package/dist/components/Tabs/TabsList.js +3 -20
- package/dist/components/Text/Text.module.css +1 -1
- package/dist/components/TextArea/TextArea.module.css +1 -1
- package/dist/components/TextArea/tests/TextArea.stories.d.ts +41 -9
- package/dist/components/TextArea/tests/TextArea.stories.js +179 -93
- package/dist/components/TextField/TextField.js +11 -3
- package/dist/components/TextField/TextField.module.css +1 -1
- package/dist/components/TextField/TextField.types.d.ts +5 -1
- package/dist/components/TextField/tests/TextField.stories.d.ts +41 -11
- package/dist/components/TextField/tests/TextField.stories.js +209 -129
- package/dist/components/Theme/Theme.module.css +1 -1
- package/dist/components/Timeline/Timeline.js +2 -2
- package/dist/components/Timeline/tests/Timeline.stories.d.ts +10 -2
- package/dist/components/Timeline/tests/Timeline.stories.js +69 -45
- package/dist/components/Toast/ToastContainer.js +1 -0
- package/dist/components/Toast/ToastRegion.js +1 -0
- package/dist/components/Toast/tests/Toast.stories.d.ts +32 -8
- package/dist/components/Toast/tests/Toast.stories.js +111 -37
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +5 -1
- package/dist/components/ToggleButton/ToggleButtonControlled.js +9 -2
- package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +4 -0
- package/dist/components/ToggleButton/tests/ToggleButton.stories.js +10 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.types.d.ts +10 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroupControlled.js +6 -41
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +1 -0
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +17 -0
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +2 -2
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +18 -4
- package/dist/components/Tooltip/tests/Tooltip.stories.js +139 -107
- package/dist/components/View/View.js +11 -4
- package/dist/components/View/View.types.d.ts +1 -1
- package/dist/components/View/tests/View.stories.d.ts +4 -0
- package/dist/components/View/tests/View.stories.js +39 -0
- package/dist/components/_private/Expandable/Expandable.js +3 -1
- package/dist/components/_private/Portal/Portal.js +4 -1
- package/dist/hooks/_private/useIsDismissible.d.ts +1 -0
- package/dist/hooks/_private/useIsDismissible.js +6 -6
- package/dist/hooks/_private/usePrevious.js +1 -0
- package/dist/hooks/tests/useDrag.stories.js +1 -1
- package/dist/{components/Toast/tests/Toast.test.stories.d.ts → hooks/tests/useKeyboardArrowNavigation.stories.d.ts} +4 -5
- package/dist/hooks/tests/useKeyboardArrowNavigation.stories.js +128 -0
- package/dist/hooks/useKeyboardArrowNavigation.d.ts +9 -0
- package/dist/hooks/useKeyboardArrowNavigation.js +62 -0
- package/dist/hooks/useOnClickOutside.js +0 -2
- package/dist/hooks/useScrollLock.js +5 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/styles/resolvers/align/align.css +1 -1
- package/dist/styles/resolvers/aspectRatio/aspectRatio.css +1 -1
- package/dist/styles/resolvers/bleed/bleed.module.css +1 -1
- package/dist/styles/resolvers/justify/justify.css +1 -1
- package/dist/styles/resolvers/maxHeight/maxHeight.module.css +1 -1
- package/dist/styles/resolvers/maxWidth/maxWidth.module.css +1 -1
- package/dist/styles/resolvers/minHeight/minHeight.module.css +1 -1
- package/dist/styles/resolvers/minWidth/minWidth.module.css +1 -1
- package/dist/styles/resolvers/position/position.css +1 -1
- package/dist/styles/resolvers/textAlign/textAlign.css +1 -1
- package/dist/styles/resolvers/width/width.module.css +1 -1
- package/dist/utilities/a11y/focus.d.ts +21 -4
- package/dist/utilities/a11y/focus.js +4 -3
- package/dist/utilities/scroll/disable.js +2 -2
- package/dist/utilities/scroll/index.d.ts +1 -1
- package/dist/utilities/scroll/index.js +1 -1
- package/dist/utilities/scroll/lock.d.ts +1 -2
- package/dist/utilities/scroll/lock.js +16 -15
- package/dist/utilities/scroll/lockSafari.js +1 -0
- package/package.json +195 -201
- package/CHANGELOG-extra.md +0 -3
- package/CHANGELOG.md +0 -57
- package/dist/components/Actionable/tests/Actionable.test.stories.d.ts +0 -32
- package/dist/components/Actionable/tests/Actionable.test.stories.js +0 -130
- package/dist/components/Alert/tests/Alert.test.stories.d.ts +0 -15
- package/dist/components/Alert/tests/Alert.test.stories.js +0 -26
- package/dist/components/Badge/tests/Badge.test.stories.d.ts +0 -20
- package/dist/components/Badge/tests/Badge.test.stories.js +0 -46
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +0 -23
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +0 -76
- package/dist/components/Button/tests/Button.test.stories.d.ts +0 -27
- package/dist/components/Button/tests/Button.test.stories.js +0 -112
- package/dist/components/Card/tests/Card.test.stories.d.ts +0 -35
- package/dist/components/Card/tests/Card.test.stories.js +0 -54
- package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +0 -25
- package/dist/components/Checkbox/tests/Checkbox.test.stories.js +0 -104
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +0 -22
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +0 -78
- package/dist/components/Container/tests/Container.test.stories.d.ts +0 -15
- package/dist/components/Container/tests/Container.test.stories.js +0 -26
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +0 -25
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +0 -53
- package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +0 -19
- package/dist/components/Dismissible/tests/Dismissible.test.stories.js +0 -42
- package/dist/components/Divider/tests/Divider.test.stories.d.ts +0 -18
- package/dist/components/Divider/tests/Divider.test.stories.js +0 -47
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +0 -36
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +0 -117
- package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +0 -20
- package/dist/components/FormControl/tests/FormControl.test.stories.js +0 -49
- package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +0 -15
- package/dist/components/Hidden/tests/Hidden.test.stories.js +0 -20
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +0 -15
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +0 -20
- package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +0 -15
- package/dist/components/Hotkey/tests/Hotkey.test.stories.js +0 -26
- package/dist/components/Icon/tests/Icon.test.stories.d.ts +0 -16
- package/dist/components/Icon/tests/Icon.test.stories.js +0 -35
- package/dist/components/Link/tests/Link.test.stories.d.ts +0 -29
- package/dist/components/Link/tests/Link.test.stories.js +0 -87
- package/dist/components/Loader/tests/Loader.test.stories.d.ts +0 -16
- package/dist/components/Loader/tests/Loader.test.stories.js +0 -32
- package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +0 -26
- package/dist/components/MenuItem/tests/MenuItem.test.stories.js +0 -100
- package/dist/components/Modal/tests/Modal.test.stories.d.ts +0 -31
- package/dist/components/Modal/tests/Modal.test.stories.js +0 -149
- package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +0 -28
- package/dist/components/Overlay/tests/Overlay.test.stories.js +0 -148
- package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +0 -23
- package/dist/components/Pagination/tests/Pagination.test.stories.js +0 -86
- package/dist/components/Progress/tests/Progress.test.stories.d.ts +0 -16
- package/dist/components/Progress/tests/Progress.test.stories.js +0 -35
- package/dist/components/Radio/tests/Radio.test.stories.d.ts +0 -30
- package/dist/components/Radio/tests/Radio.test.stories.js +0 -118
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +0 -22
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +0 -78
- package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +0 -15
- package/dist/components/Scrim/tests/Scrim.test.stories.js +0 -25
- package/dist/components/Select/tests/Select.test.stories.d.ts +0 -27
- package/dist/components/Select/tests/Select.test.stories.js +0 -132
- package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +0 -15
- package/dist/components/Skeleton/tests/Skeleton.test.stories.js +0 -23
- package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +0 -20
- package/dist/components/Stepper/tests/Stepper.test.stories.js +0 -28
- package/dist/components/Table/tests/Table.test.stories.d.ts +0 -24
- package/dist/components/Table/tests/Table.test.stories.js +0 -93
- package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +0 -28
- package/dist/components/TextArea/tests/TextArea.test.stories.js +0 -99
- package/dist/components/TextField/tests/TextField.test.stories.d.ts +0 -28
- package/dist/components/TextField/tests/TextField.test.stories.js +0 -99
- package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +0 -17
- package/dist/components/Timeline/tests/Timeline.test.stories.js +0 -32
- package/dist/components/Toast/tests/Toast.test.stories.js +0 -101
- package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +0 -19
- package/dist/components/Tooltip/tests/Tooltip.test.stories.js +0 -40
- package/dist/components/View/tests/View.test.stories.d.ts +0 -24
- package/dist/components/View/tests/View.test.stories.js +0 -50
@@ -1,132 +0,0 @@
|
|
1
|
-
import { expect, userEvent, fn } from "storybook/test";
|
2
|
-
import Select from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Select/tests",
|
5
|
-
component: Select,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/select",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const render = {
|
14
|
-
name: "rendering",
|
15
|
-
render: () => (<Select name="test-name" options={[
|
16
|
-
{ label: "Option 1", value: "1" },
|
17
|
-
{ label: "Option 2", value: "2" },
|
18
|
-
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
19
|
-
play: async ({ canvas }) => {
|
20
|
-
const elInput = canvas.getByRole("combobox");
|
21
|
-
const elOptions = canvas.getAllByRole("option");
|
22
|
-
expect(elInput).toHaveAttribute("name", "test-name");
|
23
|
-
expect(elInput).toHaveValue("1");
|
24
|
-
expect(elOptions.length).toBe(2);
|
25
|
-
expect(elOptions[0]).toHaveValue("1");
|
26
|
-
expect(elOptions[0].textContent).toBe("Option 1");
|
27
|
-
expect(elOptions[1]).toHaveValue("2");
|
28
|
-
expect(elOptions[1].textContent).toBe("Option 2");
|
29
|
-
},
|
30
|
-
};
|
31
|
-
export const startSlot = {
|
32
|
-
name: "startSlot",
|
33
|
-
render: () => (<Select name="test-name" startSlot="Slot" options={[]} inputAttributes={{ "aria-label": "test select" }}/>),
|
34
|
-
play: async ({ canvas }) => {
|
35
|
-
const slot = canvas.getByText("Slot");
|
36
|
-
expect(slot).toBeInTheDocument();
|
37
|
-
},
|
38
|
-
};
|
39
|
-
export const placeholder = {
|
40
|
-
name: "placeholder",
|
41
|
-
render: () => (<Select name="test-name" placeholder="Placeholder" options={[
|
42
|
-
{ label: "Option 1", value: "1" },
|
43
|
-
{ label: "Option 2", value: "2" },
|
44
|
-
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
45
|
-
play: async ({ canvas }) => {
|
46
|
-
const input = canvas.getByRole("combobox");
|
47
|
-
const options = canvas.getAllByRole("option");
|
48
|
-
expect(input).toHaveValue("");
|
49
|
-
expect(options.length).toBe(3);
|
50
|
-
expect(options[0].textContent).toBe("Placeholder");
|
51
|
-
expect(options[0]).toHaveValue("");
|
52
|
-
},
|
53
|
-
};
|
54
|
-
export const id = {
|
55
|
-
name: "id",
|
56
|
-
render: () => (<Select name="test-name" id="test-id" options={[
|
57
|
-
{ label: "Option 1", value: "1" },
|
58
|
-
{ label: "Option 2", value: "2" },
|
59
|
-
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
60
|
-
play: async ({ canvas }) => {
|
61
|
-
const input = canvas.getByRole("combobox");
|
62
|
-
expect(input).toHaveAttribute("id", "test-id");
|
63
|
-
},
|
64
|
-
};
|
65
|
-
export const disabled = {
|
66
|
-
name: "disabled",
|
67
|
-
render: () => (<Select name="test-name" disabled options={[
|
68
|
-
{ label: "Option 1", value: "1" },
|
69
|
-
{ label: "Option 2", value: "2" },
|
70
|
-
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
71
|
-
play: async ({ canvas }) => {
|
72
|
-
const input = canvas.getByRole("combobox");
|
73
|
-
expect(input).toBeDisabled();
|
74
|
-
},
|
75
|
-
};
|
76
|
-
export const defaultValue = {
|
77
|
-
name: "defaultValue, uncontrolled",
|
78
|
-
args: {
|
79
|
-
handleChange: fn(),
|
80
|
-
},
|
81
|
-
render: (args) => (<Select name="test-name" defaultValue="2" onChange={args.handleChange} options={[
|
82
|
-
{ label: "Option 1", value: "1" },
|
83
|
-
{ label: "Option 2", value: "2" },
|
84
|
-
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
85
|
-
play: async ({ canvas, args }) => {
|
86
|
-
const input = canvas.getByRole("combobox");
|
87
|
-
expect(input).toHaveValue("2");
|
88
|
-
await userEvent.selectOptions(input, "1");
|
89
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
90
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
91
|
-
name: "test-name",
|
92
|
-
value: "1",
|
93
|
-
event: expect.objectContaining({ target: input }),
|
94
|
-
});
|
95
|
-
expect(input).toHaveValue("1");
|
96
|
-
},
|
97
|
-
};
|
98
|
-
export const value = {
|
99
|
-
name: "value, controlled",
|
100
|
-
args: {
|
101
|
-
handleChange: fn(),
|
102
|
-
},
|
103
|
-
render: (args) => (<Select name="test-name" value="2" onChange={args.handleChange} options={[
|
104
|
-
{ label: "Option 1", value: "1" },
|
105
|
-
{ label: "Option 2", value: "2" },
|
106
|
-
]} inputAttributes={{ "aria-label": "test select" }}/>),
|
107
|
-
play: async ({ canvas, args }) => {
|
108
|
-
const input = canvas.getByRole("combobox");
|
109
|
-
expect(input).toHaveValue("2");
|
110
|
-
await userEvent.selectOptions(input, "1");
|
111
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
112
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
113
|
-
name: "test-name",
|
114
|
-
value: "1",
|
115
|
-
event: expect.objectContaining({ target: input }),
|
116
|
-
});
|
117
|
-
expect(input).toHaveValue("2");
|
118
|
-
},
|
119
|
-
};
|
120
|
-
export const className = {
|
121
|
-
name: "className, attributes",
|
122
|
-
render: () => (<div data-testid="root">
|
123
|
-
<Select className="test-classname" attributes={{ id: "test-id" }} inputAttributes={{ "aria-label": "test select", id: "test-input-id" }} options={[]} name="name"/>
|
124
|
-
</div>),
|
125
|
-
play: async ({ canvas }) => {
|
126
|
-
const root = canvas.getByTestId("root").firstChild;
|
127
|
-
const input = canvas.getByRole("combobox");
|
128
|
-
expect(root).toHaveClass("test-classname");
|
129
|
-
expect(root).toHaveAttribute("id", "test-id");
|
130
|
-
expect(input).toHaveAttribute("id", "test-input-id");
|
131
|
-
},
|
132
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").SkeletonProps>;
|
5
|
-
parameters: {
|
6
|
-
iframe: {
|
7
|
-
url: string;
|
8
|
-
};
|
9
|
-
chromatic: {
|
10
|
-
disableSnapshot: boolean;
|
11
|
-
};
|
12
|
-
};
|
13
|
-
};
|
14
|
-
export default _default;
|
15
|
-
export declare const className: StoryObj;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Skeleton from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Skeleton/tests",
|
5
|
-
component: Skeleton,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/skeleton",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const className = {
|
14
|
-
name: "className, attributes",
|
15
|
-
render: () => (<div data-testid="root">
|
16
|
-
<Skeleton className="test-classname" attributes={{ id: "test-id" }}/>
|
17
|
-
</div>),
|
18
|
-
play: async ({ canvas }) => {
|
19
|
-
const root = canvas.getByTestId("root").firstChild;
|
20
|
-
expect(root).toHaveClass("test-classname");
|
21
|
-
expect(root).toHaveAttribute("id", "test-id");
|
22
|
-
},
|
23
|
-
};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").StepperProps> & {
|
5
|
-
Item: {
|
6
|
-
(_: import("../Stepper.types").ItemProps): null;
|
7
|
-
displayName: string;
|
8
|
-
};
|
9
|
-
};
|
10
|
-
parameters: {
|
11
|
-
iframe: {
|
12
|
-
url: string;
|
13
|
-
};
|
14
|
-
chromatic: {
|
15
|
-
disableSnapshot: boolean;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
};
|
19
|
-
export default _default;
|
20
|
-
export declare const className: StoryObj;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Stepper from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Stepper/tests",
|
5
|
-
component: Stepper,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/stepper",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const className = {
|
14
|
-
name: "className, attributes",
|
15
|
-
render: () => (<div data-testid="root">
|
16
|
-
<Stepper className="test-classname" attributes={{ id: "test-id" }}>
|
17
|
-
<Stepper.Item attributes={{ id: "test-item-id" }} className="test-item-classname"/>
|
18
|
-
</Stepper>
|
19
|
-
</div>),
|
20
|
-
play: async ({ canvas }) => {
|
21
|
-
const root = canvas.getByTestId("root").firstChild;
|
22
|
-
const item = root?.firstChild;
|
23
|
-
expect(root).toHaveClass("test-classname");
|
24
|
-
expect(root).toHaveAttribute("id", "test-id");
|
25
|
-
expect(item).toHaveClass("test-item-classname");
|
26
|
-
expect(item).toHaveAttribute("id", "test-item-id");
|
27
|
-
},
|
28
|
-
};
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").TableProps> & {
|
5
|
-
Cell: import("react").FC<import("./..").TableCellProps>;
|
6
|
-
Heading: import("react").FC<import("./..").TableHeadingProps>;
|
7
|
-
Row: import("react").FC<import("./..").TableRowProps>;
|
8
|
-
Body: import("react").FC<import("./..").TableBodyProps>;
|
9
|
-
Head: import("react").FC<import("./..").TableHeadProps>;
|
10
|
-
};
|
11
|
-
parameters: {
|
12
|
-
iframe: {
|
13
|
-
url: string;
|
14
|
-
};
|
15
|
-
chromatic: {
|
16
|
-
disableSnapshot: boolean;
|
17
|
-
};
|
18
|
-
};
|
19
|
-
};
|
20
|
-
export default _default;
|
21
|
-
export declare const render: StoryObj;
|
22
|
-
export declare const tbody: StoryObj;
|
23
|
-
export declare const tabIndex: StoryObj;
|
24
|
-
export declare const className: StoryObj;
|
@@ -1,93 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Table from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Table/tests",
|
5
|
-
component: Table,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/table",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const render = {
|
14
|
-
name: "rendering",
|
15
|
-
render: () => (<Table>
|
16
|
-
<Table.Head>
|
17
|
-
<Table.Row>
|
18
|
-
<Table.Heading>Heading</Table.Heading>
|
19
|
-
<Table.Heading>Heading</Table.Heading>
|
20
|
-
</Table.Row>
|
21
|
-
</Table.Head>
|
22
|
-
<Table.Body>
|
23
|
-
<Table.Row>
|
24
|
-
<Table.Cell>Content</Table.Cell>
|
25
|
-
<Table.Cell>Content</Table.Cell>
|
26
|
-
</Table.Row>
|
27
|
-
</Table.Body>
|
28
|
-
</Table>),
|
29
|
-
play: async ({ canvas }) => {
|
30
|
-
const body = canvas.getAllByRole("rowgroup");
|
31
|
-
const rows = canvas.getAllByRole("row");
|
32
|
-
const headings = canvas.getAllByRole("columnheader");
|
33
|
-
const cells = canvas.getAllByRole("cell");
|
34
|
-
expect(body).toHaveLength(2);
|
35
|
-
expect(rows).toHaveLength(2);
|
36
|
-
expect(headings).toHaveLength(2);
|
37
|
-
expect(cells).toHaveLength(2);
|
38
|
-
expect(canvas.getAllByText("Heading")).toHaveLength(2);
|
39
|
-
expect(canvas.getAllByText("Content")).toHaveLength(2);
|
40
|
-
},
|
41
|
-
};
|
42
|
-
export const tbody = {
|
43
|
-
name: "tbody rendering",
|
44
|
-
render: () => (<Table>
|
45
|
-
<Table.Row>
|
46
|
-
<Table.Heading>Heading</Table.Heading>
|
47
|
-
<Table.Heading>Heading</Table.Heading>
|
48
|
-
</Table.Row>
|
49
|
-
</Table>),
|
50
|
-
play: async ({ canvas }) => {
|
51
|
-
const body = canvas.getByRole("rowgroup");
|
52
|
-
expect(body).toBeInTheDocument();
|
53
|
-
},
|
54
|
-
};
|
55
|
-
export const tabIndex = {
|
56
|
-
name: "adds tabIndex for clickable rows",
|
57
|
-
render: () => (<Table>
|
58
|
-
<Table.Row>
|
59
|
-
<Table.Cell />
|
60
|
-
</Table.Row>
|
61
|
-
<Table.Row onClick={() => { }}>
|
62
|
-
<Table.Cell />
|
63
|
-
</Table.Row>
|
64
|
-
<Table.Row attributes={{ onClick: () => { } }}>
|
65
|
-
<Table.Cell />
|
66
|
-
</Table.Row>
|
67
|
-
</Table>),
|
68
|
-
play: async ({ canvas }) => {
|
69
|
-
const elRows = canvas.getAllByRole("row");
|
70
|
-
expect(elRows[0]).not.toHaveAttribute("tabIndex");
|
71
|
-
expect(elRows[1]).toHaveAttribute("tabIndex", "0");
|
72
|
-
expect(elRows[2]).toHaveAttribute("tabIndex", "0");
|
73
|
-
},
|
74
|
-
};
|
75
|
-
export const className = {
|
76
|
-
name: "className, attributes",
|
77
|
-
render: () => (<div data-testid="root">
|
78
|
-
<Table className="test-classname" attributes={{ id: "test-id" }}>
|
79
|
-
<Table.Row attributes={{ id: "test-row-id" }}>
|
80
|
-
<Table.Cell attributes={{ id: "test-cell-id" }}></Table.Cell>
|
81
|
-
</Table.Row>
|
82
|
-
</Table>
|
83
|
-
</div>),
|
84
|
-
play: async ({ canvas }) => {
|
85
|
-
const root = canvas.getByTestId("root").firstChild;
|
86
|
-
const row = canvas.getByRole("row");
|
87
|
-
const cell = canvas.getByRole("cell");
|
88
|
-
expect(root).toHaveClass("test-classname");
|
89
|
-
expect(root).toHaveAttribute("id", "test-id");
|
90
|
-
expect(row).toHaveAttribute("id", "test-row-id");
|
91
|
-
expect(cell).toHaveAttribute("id", "test-cell-id");
|
92
|
-
},
|
93
|
-
};
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
import { fn } from "storybook/test";
|
3
|
-
declare const _default: {
|
4
|
-
title: string;
|
5
|
-
component: import("react").FC<import("./..").TextAreaProps> & {
|
6
|
-
Aligner: import("react").FC<import("../../_private/Aligner").AlignerProps>;
|
7
|
-
};
|
8
|
-
parameters: {
|
9
|
-
iframe: {
|
10
|
-
url: string;
|
11
|
-
};
|
12
|
-
chromatic: {
|
13
|
-
disableSnapshot: boolean;
|
14
|
-
};
|
15
|
-
};
|
16
|
-
};
|
17
|
-
export default _default;
|
18
|
-
export declare const render: StoryObj;
|
19
|
-
export declare const placeholder: StoryObj;
|
20
|
-
export declare const id: StoryObj;
|
21
|
-
export declare const disabled: StoryObj;
|
22
|
-
export declare const defaultValue: StoryObj<{
|
23
|
-
handleChange: ReturnType<typeof fn>;
|
24
|
-
}>;
|
25
|
-
export declare const value: StoryObj<{
|
26
|
-
handleChange: ReturnType<typeof fn>;
|
27
|
-
}>;
|
28
|
-
export declare const className: StoryObj;
|
@@ -1,99 +0,0 @@
|
|
1
|
-
import { expect, fn, userEvent } from "storybook/test";
|
2
|
-
import TextArea from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/TextArea/tests",
|
5
|
-
component: TextArea,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/text-area",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const render = {
|
14
|
-
name: "base",
|
15
|
-
render: () => <TextArea name="test-name" inputAttributes={{ "aria-label": "Label" }}/>,
|
16
|
-
play: async ({ canvas }) => {
|
17
|
-
const input = canvas.getByRole("textbox");
|
18
|
-
expect(input).toHaveAttribute("name", "test-name");
|
19
|
-
expect(input).toHaveAccessibleName("Label");
|
20
|
-
},
|
21
|
-
};
|
22
|
-
export const placeholder = {
|
23
|
-
name: "placeholder",
|
24
|
-
render: () => (<TextArea name="test-name" placeholder="Placeholder" inputAttributes={{ "aria-label": "Label" }}/>),
|
25
|
-
play: async ({ canvas }) => {
|
26
|
-
const input = canvas.getByRole("textbox");
|
27
|
-
expect(input).toHaveValue("");
|
28
|
-
expect(input).toHaveAttribute("placeholder", "Placeholder");
|
29
|
-
},
|
30
|
-
};
|
31
|
-
export const id = {
|
32
|
-
name: "id",
|
33
|
-
render: () => (<TextArea name="test-name" id="test-id" inputAttributes={{ "aria-label": "Label" }}/>),
|
34
|
-
play: async ({ canvas }) => {
|
35
|
-
const input = canvas.getByRole("textbox");
|
36
|
-
expect(input).toHaveAttribute("id", "test-id");
|
37
|
-
},
|
38
|
-
};
|
39
|
-
export const disabled = {
|
40
|
-
name: "disabled",
|
41
|
-
render: () => <TextArea name="test-name" disabled inputAttributes={{ "aria-label": "Label" }}/>,
|
42
|
-
play: async ({ canvas }) => {
|
43
|
-
const input = canvas.getByRole("textbox");
|
44
|
-
expect(input).toBeDisabled();
|
45
|
-
},
|
46
|
-
};
|
47
|
-
export const defaultValue = {
|
48
|
-
name: "defaultValue, uncontrolled",
|
49
|
-
args: {
|
50
|
-
handleChange: fn(),
|
51
|
-
},
|
52
|
-
render: (args) => (<TextArea name="test-name" defaultValue="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
53
|
-
play: async ({ canvas, args }) => {
|
54
|
-
const input = canvas.getByRole("textbox");
|
55
|
-
expect(input).toHaveValue("value");
|
56
|
-
input.focus();
|
57
|
-
await userEvent.keyboard("2");
|
58
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
59
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
60
|
-
name: "test-name",
|
61
|
-
value: "2value",
|
62
|
-
event: expect.objectContaining({ target: input }),
|
63
|
-
});
|
64
|
-
expect(input).toHaveValue("2value");
|
65
|
-
},
|
66
|
-
};
|
67
|
-
export const value = {
|
68
|
-
name: "value, controlled",
|
69
|
-
args: {
|
70
|
-
handleChange: fn(),
|
71
|
-
},
|
72
|
-
render: (args) => (<TextArea name="test-name" value="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
73
|
-
play: async ({ canvas, args }) => {
|
74
|
-
const input = canvas.getByRole("textbox");
|
75
|
-
expect(input).toHaveValue("value");
|
76
|
-
input.focus();
|
77
|
-
await userEvent.keyboard("2");
|
78
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
79
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
80
|
-
name: "test-name",
|
81
|
-
value: "2value",
|
82
|
-
event: expect.objectContaining({ target: input }),
|
83
|
-
});
|
84
|
-
expect(input).toHaveValue("value");
|
85
|
-
},
|
86
|
-
};
|
87
|
-
export const className = {
|
88
|
-
name: "className, attributes",
|
89
|
-
render: () => (<div data-testid="root">
|
90
|
-
<TextArea className="test-classname" attributes={{ id: "test-id" }} name="name" inputAttributes={{ id: "test-input-id", "aria-label": "Label" }}/>
|
91
|
-
</div>),
|
92
|
-
play: async ({ canvas }) => {
|
93
|
-
const root = canvas.getByTestId("root").firstChild;
|
94
|
-
const input = canvas.getByRole("textbox");
|
95
|
-
expect(root).toHaveClass("test-classname");
|
96
|
-
expect(root).toHaveAttribute("id", "test-id");
|
97
|
-
expect(input).toHaveAttribute("id", "test-input-id");
|
98
|
-
},
|
99
|
-
};
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
import { fn } from "storybook/test";
|
3
|
-
declare const _default: {
|
4
|
-
title: string;
|
5
|
-
component: import("react").FC<import("./..").TextFieldProps> & {
|
6
|
-
Aligner: import("react").FC<import("../../_private/Aligner").AlignerProps>;
|
7
|
-
};
|
8
|
-
parameters: {
|
9
|
-
iframe: {
|
10
|
-
url: string;
|
11
|
-
};
|
12
|
-
chromatic: {
|
13
|
-
disableSnapshot: boolean;
|
14
|
-
};
|
15
|
-
};
|
16
|
-
};
|
17
|
-
export default _default;
|
18
|
-
export declare const render: StoryObj;
|
19
|
-
export declare const placeholder: StoryObj;
|
20
|
-
export declare const id: StoryObj;
|
21
|
-
export declare const disabled: StoryObj;
|
22
|
-
export declare const defaultValue: StoryObj<{
|
23
|
-
handleChange: ReturnType<typeof fn>;
|
24
|
-
}>;
|
25
|
-
export declare const value: StoryObj<{
|
26
|
-
handleChange: ReturnType<typeof fn>;
|
27
|
-
}>;
|
28
|
-
export declare const className: StoryObj;
|
@@ -1,99 +0,0 @@
|
|
1
|
-
import { expect, fn, userEvent } from "storybook/test";
|
2
|
-
import TextField from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/TextField/tests",
|
5
|
-
component: TextField,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/text-area",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const render = {
|
14
|
-
name: "base",
|
15
|
-
render: () => <TextField name="test-name" inputAttributes={{ "aria-label": "Label" }}/>,
|
16
|
-
play: async ({ canvas }) => {
|
17
|
-
const input = canvas.getByRole("textbox");
|
18
|
-
expect(input).toHaveAttribute("name", "test-name");
|
19
|
-
expect(input).toHaveAccessibleName("Label");
|
20
|
-
},
|
21
|
-
};
|
22
|
-
export const placeholder = {
|
23
|
-
name: "placeholder",
|
24
|
-
render: () => (<TextField name="test-name" placeholder="Placeholder" inputAttributes={{ "aria-label": "Label" }}/>),
|
25
|
-
play: async ({ canvas }) => {
|
26
|
-
const input = canvas.getByRole("textbox");
|
27
|
-
expect(input).toHaveValue("");
|
28
|
-
expect(input).toHaveAttribute("placeholder", "Placeholder");
|
29
|
-
},
|
30
|
-
};
|
31
|
-
export const id = {
|
32
|
-
name: "id",
|
33
|
-
render: () => (<TextField name="test-name" id="test-id" inputAttributes={{ "aria-label": "Label" }}/>),
|
34
|
-
play: async ({ canvas }) => {
|
35
|
-
const input = canvas.getByRole("textbox");
|
36
|
-
expect(input).toHaveAttribute("id", "test-id");
|
37
|
-
},
|
38
|
-
};
|
39
|
-
export const disabled = {
|
40
|
-
name: "disabled",
|
41
|
-
render: () => <TextField name="test-name" disabled inputAttributes={{ "aria-label": "Label" }}/>,
|
42
|
-
play: async ({ canvas }) => {
|
43
|
-
const input = canvas.getByRole("textbox");
|
44
|
-
expect(input).toBeDisabled();
|
45
|
-
},
|
46
|
-
};
|
47
|
-
export const defaultValue = {
|
48
|
-
name: "defaultValue, uncontrolled",
|
49
|
-
args: {
|
50
|
-
handleChange: fn(),
|
51
|
-
},
|
52
|
-
render: (args) => (<TextField name="test-name" defaultValue="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
53
|
-
play: async ({ canvas, args }) => {
|
54
|
-
const input = canvas.getByRole("textbox");
|
55
|
-
expect(input).toHaveValue("value");
|
56
|
-
input.focus();
|
57
|
-
await userEvent.keyboard("2");
|
58
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
59
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
60
|
-
name: "test-name",
|
61
|
-
value: "value2",
|
62
|
-
event: expect.objectContaining({ target: input }),
|
63
|
-
});
|
64
|
-
expect(input).toHaveValue("value2");
|
65
|
-
},
|
66
|
-
};
|
67
|
-
export const value = {
|
68
|
-
name: "value, controlled",
|
69
|
-
args: {
|
70
|
-
handleChange: fn(),
|
71
|
-
},
|
72
|
-
render: (args) => (<TextField name="test-name" value="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
73
|
-
play: async ({ canvas, args }) => {
|
74
|
-
const input = canvas.getByRole("textbox");
|
75
|
-
expect(input).toHaveValue("value");
|
76
|
-
input.focus();
|
77
|
-
await userEvent.keyboard("2");
|
78
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
79
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
80
|
-
name: "test-name",
|
81
|
-
value: "value2",
|
82
|
-
event: expect.objectContaining({ target: input }),
|
83
|
-
});
|
84
|
-
expect(input).toHaveValue("value");
|
85
|
-
},
|
86
|
-
};
|
87
|
-
export const className = {
|
88
|
-
name: "className, attributes",
|
89
|
-
render: () => (<div data-testid="root">
|
90
|
-
<TextField className="test-classname" attributes={{ id: "test-id" }} name="name" inputAttributes={{ id: "test-input-id", "aria-label": "Label" }}/>
|
91
|
-
</div>),
|
92
|
-
play: async ({ canvas }) => {
|
93
|
-
const root = canvas.getByTestId("root").firstChild;
|
94
|
-
const input = canvas.getByRole("textbox");
|
95
|
-
expect(root).toHaveClass("test-classname");
|
96
|
-
expect(root).toHaveAttribute("id", "test-id");
|
97
|
-
expect(input).toHaveAttribute("id", "test-input-id");
|
98
|
-
},
|
99
|
-
};
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
declare const _default: {
|
3
|
-
title: string;
|
4
|
-
component: import("react").FC<import("./..").TimelineProps> & {
|
5
|
-
Item: import("react").FC<import("./..").TimelineItemProps>;
|
6
|
-
};
|
7
|
-
parameters: {
|
8
|
-
iframe: {
|
9
|
-
url: string;
|
10
|
-
};
|
11
|
-
chromatic: {
|
12
|
-
disableSnapshot: boolean;
|
13
|
-
};
|
14
|
-
};
|
15
|
-
};
|
16
|
-
export default _default;
|
17
|
-
export declare const className: StoryObj;
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { expect } from "storybook/test";
|
2
|
-
import Timeline from "../index.js";
|
3
|
-
export default {
|
4
|
-
title: "Components/Timeline/tests",
|
5
|
-
component: Timeline,
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: "https://reshaped.so/docs/components/timeline",
|
9
|
-
},
|
10
|
-
chromatic: { disableSnapshot: true },
|
11
|
-
},
|
12
|
-
};
|
13
|
-
export const className = {
|
14
|
-
name: "className, attributes",
|
15
|
-
render: () => (<div data-testid="root">
|
16
|
-
<Timeline className="test-classname" attributes={{ id: "test-id" }}>
|
17
|
-
<Timeline.Item className="test-item-classname" attributes={{ id: "test-item-id" }}>
|
18
|
-
Content
|
19
|
-
</Timeline.Item>
|
20
|
-
<Timeline.Item>Content</Timeline.Item>
|
21
|
-
</Timeline>
|
22
|
-
</div>),
|
23
|
-
play: async ({ canvas }) => {
|
24
|
-
const root = canvas.getByTestId("root").firstChild;
|
25
|
-
const items = canvas.getAllByRole("listitem");
|
26
|
-
expect(root).toHaveClass("test-classname");
|
27
|
-
expect(root).toHaveAttribute("id", "test-id");
|
28
|
-
expect(items).toHaveLength(2);
|
29
|
-
expect(items[0]).toHaveClass("test-item-classname");
|
30
|
-
expect(items[0]).toHaveAttribute("id", "test-item-id");
|
31
|
-
},
|
32
|
-
};
|