@onewelcome/react-lib-components 0.2.0 → 0.2.3
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/Breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/Button/BaseButton.d.ts +4 -4
- package/dist/Button/Button.d.ts +3 -3
- package/dist/Button/IconButton.d.ts +4 -4
- package/dist/ContextMenu/ContextMenu.d.ts +5 -5
- package/dist/ContextMenu/ContextMenuItem.d.ts +2 -2
- package/dist/DataGrid/DataGrid.d.ts +6 -6
- package/dist/DataGrid/DataGridActions/DataGridActions.d.ts +4 -4
- package/dist/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +3 -3
- package/dist/DataGrid/DataGridBody/DataGridBody.d.ts +3 -3
- package/dist/DataGrid/DataGridBody/DataGridCell.d.ts +2 -2
- package/dist/DataGrid/DataGridBody/DataGridRow.d.ts +3 -3
- package/dist/DataGrid/DataGridHeader/DataGridHeader.d.ts +3 -3
- package/dist/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +3 -3
- package/dist/DataGrid/datagrid.interfaces.d.ts +1 -1
- package/dist/Form/Checkbox/Checkbox.d.ts +5 -5
- package/dist/Form/Fieldset/Fieldset.d.ts +3 -3
- package/dist/Form/Form.d.ts +1 -1
- package/dist/Form/FormControl/FormControl.d.ts +3 -3
- package/dist/Form/FormGroup/FormGroup.d.ts +5 -5
- package/dist/Form/FormHelperText/FormHelperText.d.ts +3 -3
- package/dist/Form/FormSelectorWrapper/FormSelectorWrapper.d.ts +6 -6
- package/dist/Form/Input/Input.d.ts +5 -5
- package/dist/Form/Label/Label.d.ts +2 -2
- package/dist/Form/Radio/Radio.d.ts +5 -5
- package/dist/Form/Select/Option.d.ts +2 -2
- package/dist/Form/Select/Select.d.ts +5 -5
- package/dist/Form/Textarea/Textarea.d.ts +6 -6
- package/dist/Form/Toggle/Toggle.d.ts +3 -3
- package/dist/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/InputWrapper/InputWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/RadioWrapper/RadioWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/TextareaWrapper/TextareaWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/Wrapper/Wrapper.d.ts +6 -6
- package/dist/Form/form.interfaces.d.ts +1 -1
- package/dist/Icon/Icon.d.ts +3 -3
- package/dist/Link/Link.d.ts +7 -7
- package/dist/Notifications/BaseModal/BaseModal.d.ts +4 -4
- package/dist/Notifications/BaseModal/BaseModalActions/BaseModalActions.d.ts +2 -2
- package/dist/Notifications/BaseModal/BaseModalContent/BaseModalContent.d.ts +2 -2
- package/dist/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +2 -2
- package/dist/Notifications/Dialog/Dialog.d.ts +5 -5
- package/dist/Notifications/Dialog/DialogActions/DialogActions.d.ts +3 -3
- package/dist/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +2 -2
- package/dist/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.d.ts +3 -3
- package/dist/Notifications/DiscardChangesModal/DiscardChangesModal.d.ts +7 -7
- package/dist/Notifications/Modal/Modal.d.ts +1 -1
- package/dist/Notifications/Modal/ModalActions/ModalActions.d.ts +1 -1
- package/dist/Notifications/Modal/ModalContent/ModalContent.d.ts +1 -1
- package/dist/Notifications/Modal/ModalHeader/ModalHeader.d.ts +1 -1
- package/dist/Notifications/SlideInModal/SlideInModal.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarItem/SnackbarItem.d.ts +2 -2
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.d.ts +2 -2
- package/dist/Notifications/Snackbar/interfaces.d.ts +2 -2
- package/dist/Pagination/Pagination.d.ts +3 -3
- package/dist/Popover/Popover.d.ts +3 -3
- package/dist/Skeleton/Skeleton.d.ts +3 -3
- package/dist/StatusIndicator/StatusIndicator.d.ts +5 -5
- package/dist/Tabs/Tab.d.ts +1 -1
- package/dist/Tabs/TabButton.d.ts +2 -2
- package/dist/Tabs/TabPanel.d.ts +2 -2
- package/dist/Tabs/Tabs.d.ts +4 -4
- package/dist/TextEllipsis/TextEllipsis.d.ts +2 -2
- package/dist/Tiles/Tile.d.ts +5 -5
- package/dist/Tiles/Tiles.d.ts +2 -2
- package/dist/Tooltip/Tooltip.d.ts +3 -3
- package/dist/Typography/Typography.d.ts +3 -3
- package/dist/Wizard/BaseWizardSteps/BaseWizardSteps.d.ts +2 -2
- package/dist/Wizard/Wizard.d.ts +3 -3
- package/dist/Wizard/WizardActions/WizardActions.d.ts +2 -2
- package/dist/Wizard/WizardStateProvider.d.ts +2 -2
- package/dist/Wizard/WizardSteps/WizardSteps.d.ts +2 -2
- package/dist/Wizard/wizardStateReducer.d.ts +5 -5
- package/dist/_BaseStyling_/BaseStyling.d.ts +1 -1
- package/dist/hooks/usePosition.d.ts +4 -4
- package/dist/hooks/useRepeater.d.ts +1 -1
- package/dist/hooks/useScroll.d.ts +1 -1
- package/dist/hooks/useSpacing.d.ts +1 -1
- package/dist/hooks/useWrapper.d.ts +1 -1
- package/dist/index.d.ts +55 -55
- package/dist/react-lib-components.cjs.development.js +676 -578
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +676 -578
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +27 -16
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +15 -15
- package/src/Breadcrumbs/Breadcrumbs.tsx +11 -11
- package/src/Button/BaseButton.module.scss +1 -1
- package/src/Button/BaseButton.test.tsx +27 -27
- package/src/Button/BaseButton.tsx +8 -8
- package/src/Button/Button.module.scss +5 -5
- package/src/Button/Button.test.tsx +39 -39
- package/src/Button/Button.tsx +10 -10
- package/src/Button/IconButton.module.scss +5 -5
- package/src/Button/IconButton.test.tsx +29 -29
- package/src/Button/IconButton.tsx +11 -11
- package/src/ContextMenu/ContextMenu.test.tsx +97 -76
- package/src/ContextMenu/ContextMenu.tsx +48 -42
- package/src/ContextMenu/ContextMenuItem.module.scss +1 -1
- package/src/ContextMenu/ContextMenuItem.tsx +7 -5
- package/src/DataGrid/DataGrid.test.tsx +193 -193
- package/src/DataGrid/DataGrid.tsx +26 -26
- package/src/DataGrid/DataGridActions/DataGridActions.test.tsx +63 -63
- package/src/DataGrid/DataGridActions/DataGridActions.tsx +15 -15
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss +1 -1
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.test.tsx +21 -21
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +20 -20
- package/src/DataGrid/DataGridBody/DataGridBody.test.tsx +40 -40
- package/src/DataGrid/DataGridBody/DataGridBody.tsx +10 -10
- package/src/DataGrid/DataGridBody/DataGridCell.module.scss +1 -1
- package/src/DataGrid/DataGridBody/DataGridCell.test.tsx +25 -25
- package/src/DataGrid/DataGridBody/DataGridCell.tsx +6 -6
- package/src/DataGrid/DataGridBody/DataGridRow.test.tsx +38 -38
- package/src/DataGrid/DataGridBody/DataGridRow.tsx +8 -8
- package/src/DataGrid/DataGridHeader/DataGridHeader.module.scss +1 -2
- package/src/DataGrid/DataGridHeader/DataGridHeader.test.tsx +119 -119
- package/src/DataGrid/DataGridHeader/DataGridHeader.tsx +13 -13
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss +2 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.test.tsx +51 -51
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.tsx +14 -14
- package/src/DataGrid/datagrid.interfaces.ts +1 -1
- package/src/Form/Checkbox/Checkbox.test.tsx +74 -74
- package/src/Form/Checkbox/Checkbox.tsx +27 -27
- package/src/Form/Fieldset/Fieldset.module.scss +1 -1
- package/src/Form/Fieldset/Fieldset.test.tsx +35 -35
- package/src/Form/Fieldset/Fieldset.tsx +27 -27
- package/src/Form/Form.test.tsx +18 -18
- package/src/Form/Form.tsx +3 -3
- package/src/Form/FormControl/FormControl.test.tsx +22 -22
- package/src/Form/FormControl/FormControl.tsx +10 -10
- package/src/Form/FormGroup/FormGroup.test.tsx +37 -37
- package/src/Form/FormGroup/FormGroup.tsx +16 -16
- package/src/Form/FormHelperText/FormHelperText.test.tsx +18 -18
- package/src/Form/FormHelperText/FormHelperText.tsx +7 -7
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.test.tsx +15 -15
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.tsx +14 -14
- package/src/Form/Input/Input.module.scss +20 -44
- package/src/Form/Input/Input.test.tsx +121 -73
- package/src/Form/Input/Input.tsx +96 -35
- package/src/Form/Label/Label.test.tsx +13 -13
- package/src/Form/Label/Label.tsx +6 -6
- package/src/Form/Radio/Radio.test.tsx +35 -35
- package/src/Form/Radio/Radio.tsx +17 -17
- package/src/Form/Select/Option.test.tsx +10 -10
- package/src/Form/Select/Option.tsx +8 -8
- package/src/Form/Select/Select.module.scss +7 -9
- package/src/Form/Select/Select.test.tsx +144 -141
- package/src/Form/Select/Select.tsx +79 -78
- package/src/Form/Textarea/Textarea.module.scss +8 -18
- package/src/Form/Textarea/Textarea.test.tsx +27 -27
- package/src/Form/Textarea/Textarea.tsx +33 -13
- package/src/Form/Toggle/Toggle.module.scss +1 -1
- package/src/Form/Toggle/Toggle.test.tsx +22 -22
- package/src/Form/Toggle/Toggle.tsx +10 -10
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +39 -39
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.tsx +12 -12
- package/src/Form/Wrapper/InputWrapper/InputWrapper.module.scss +2 -8
- package/src/Form/Wrapper/InputWrapper/InputWrapper.test.tsx +55 -55
- package/src/Form/Wrapper/InputWrapper/InputWrapper.tsx +30 -35
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.test.tsx +35 -35
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.tsx +12 -12
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.test.tsx +55 -55
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +12 -12
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +2 -11
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.tsx +50 -50
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.tsx +22 -22
- package/src/Form/Wrapper/Wrapper/Wrapper.module.scss +2 -2
- package/src/Form/Wrapper/Wrapper/Wrapper.test.tsx +11 -11
- package/src/Form/Wrapper/Wrapper/Wrapper.tsx +17 -17
- package/src/Form/form.interfaces.ts +1 -1
- package/src/Icon/Icon.module.scss +71 -71
- package/src/Icon/Icon.test.tsx +18 -18
- package/src/Icon/Icon.tsx +70 -70
- package/src/Link/Link.module.scss +5 -5
- package/src/Link/Link.test.tsx +76 -76
- package/src/Link/Link.tsx +27 -27
- package/src/Link/types.d.ts +1 -1
- package/src/Notifications/BaseModal/BaseModal.module.scss +1 -1
- package/src/Notifications/BaseModal/BaseModal.test.tsx +53 -53
- package/src/Notifications/BaseModal/BaseModal.tsx +16 -16
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.tsx +13 -13
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +5 -5
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.tsx +16 -16
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.tsx +5 -5
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.tsx +19 -19
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +10 -10
- package/src/Notifications/Dialog/Dialog.test.tsx +35 -35
- package/src/Notifications/Dialog/Dialog.tsx +19 -19
- package/src/Notifications/Dialog/DialogActions/DialogActions.test.tsx +14 -14
- package/src/Notifications/Dialog/DialogActions/DialogActions.tsx +6 -6
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.test.tsx +12 -12
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.tsx +6 -6
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.tsx +20 -20
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.tsx +7 -7
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.test.tsx +36 -36
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.tsx +8 -8
- package/src/Notifications/Modal/Modal.test.tsx +6 -6
- package/src/Notifications/Modal/Modal.tsx +1 -1
- package/src/Notifications/Modal/ModalActions/ModalActions.tsx +2 -2
- package/src/Notifications/Modal/ModalContent/ModalContent.tsx +2 -2
- package/src/Notifications/Modal/ModalHeader/ModalHeader.tsx +2 -2
- package/src/Notifications/SlideInModal/SlideInModal.test.tsx +16 -16
- package/src/Notifications/SlideInModal/SlideInModal.tsx +16 -11
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.tsx +16 -16
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.tsx +6 -6
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +2 -2
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.tsx +17 -17
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.tsx +23 -23
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.tsx +32 -32
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.tsx +18 -18
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.tsx +3 -3
- package/src/Notifications/Snackbar/interfaces.ts +2 -2
- package/src/Notifications/Snackbar/useSnackbar.ts +2 -2
- package/src/Pagination/Pagination.module.scss +2 -0
- package/src/Pagination/Pagination.test.tsx +47 -47
- package/src/Pagination/Pagination.tsx +35 -35
- package/src/Popover/Popover.test.tsx +19 -19
- package/src/Popover/Popover.tsx +7 -7
- package/src/Skeleton/Skeleton.module.scss +2 -2
- package/src/Skeleton/Skeleton.test.tsx +29 -29
- package/src/Skeleton/Skeleton.tsx +10 -10
- package/src/StatusIndicator/StatusIndicator.test.tsx +38 -38
- package/src/StatusIndicator/StatusIndicator.tsx +9 -9
- package/src/Tabs/Tab.test.tsx +13 -13
- package/src/Tabs/Tab.tsx +1 -1
- package/src/Tabs/TabButton.test.tsx +28 -28
- package/src/Tabs/TabButton.tsx +7 -7
- package/src/Tabs/TabPanel.test.tsx +30 -30
- package/src/Tabs/TabPanel.tsx +4 -4
- package/src/Tabs/Tabs.test.tsx +93 -93
- package/src/Tabs/Tabs.tsx +25 -25
- package/src/TextEllipsis/TextEllipsis.test.tsx +22 -22
- package/src/TextEllipsis/TextEllipsis.tsx +6 -6
- package/src/Tiles/Tile.module.scss +1 -1
- package/src/Tiles/Tile.test.tsx +42 -42
- package/src/Tiles/Tile.tsx +22 -22
- package/src/Tiles/Tiles.test.tsx +30 -30
- package/src/Tiles/Tiles.tsx +9 -9
- package/src/Tooltip/Tooltip.test.tsx +35 -35
- package/src/Tooltip/Tooltip.tsx +21 -21
- package/src/Typography/Typography.module.scss +1 -1
- package/src/Typography/Typography.test.tsx +49 -49
- package/src/Typography/Typography.tsx +42 -42
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.module.scss +1 -1
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.test.tsx +26 -26
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.tsx +24 -24
- package/src/Wizard/Wizard.test.tsx +56 -56
- package/src/Wizard/Wizard.tsx +6 -6
- package/src/Wizard/WizardActions/WizardActions.test.tsx +34 -34
- package/src/Wizard/WizardActions/WizardActions.tsx +14 -14
- package/src/Wizard/WizardStateProvider.tsx +3 -3
- package/src/Wizard/WizardSteps/WizardSteps.test.tsx +27 -27
- package/src/Wizard/WizardSteps/WizardSteps.tsx +7 -7
- package/src/Wizard/wizardStateReducer.ts +9 -9
- package/src/_BaseStyling_/BaseStyling.test.tsx +14 -14
- package/src/_BaseStyling_/BaseStyling.tsx +50 -50
- package/src/hooks/useAnimation.test.tsx +12 -12
- package/src/hooks/useAnimation.ts +4 -4
- package/src/hooks/useBodyClick.test.tsx +8 -8
- package/src/hooks/useBodyClick.ts +3 -3
- package/src/hooks/useFormSelector.test.ts +17 -17
- package/src/hooks/useFormSelector.ts +4 -4
- package/src/hooks/usePosition.test.tsx +215 -215
- package/src/hooks/usePosition.ts +68 -68
- package/src/hooks/useRepeater.test.tsx +26 -26
- package/src/hooks/useRepeater.ts +5 -5
- package/src/hooks/useScroll.test.tsx +5 -5
- package/src/hooks/useScroll.ts +3 -3
- package/src/hooks/useSpacing.test.ts +40 -40
- package/src/hooks/useSpacing.ts +3 -3
- package/src/hooks/useWrapper.test.ts +12 -12
- package/src/hooks/useWrapper.ts +14 -7
- package/src/index.ts +67 -67
- package/src/mixins.module.scss +76 -27
- package/src/types.d.ts +1 -1
- package/src/util/helper.test.tsx +25 -25
- package/src/util/helper.tsx +64 -64
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from
|
|
2
|
-
import { Select as SelectComponent, Props } from
|
|
3
|
-
import { render, waitFor } from
|
|
4
|
-
import { Option } from
|
|
5
|
-
import userEvent from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Select as SelectComponent, Props } from "./Select";
|
|
3
|
+
import { render, waitFor } from "@testing-library/react";
|
|
4
|
+
import { Option } from "./Option";
|
|
5
|
+
import userEvent from "@testing-library/user-event";
|
|
6
6
|
|
|
7
7
|
const defaultParams: Props = {
|
|
8
|
-
name:
|
|
8
|
+
name: "Example select",
|
|
9
9
|
children: [
|
|
10
10
|
<Option value="option1">Test</Option>,
|
|
11
11
|
<Option value="option2">Test2</Option>,
|
|
@@ -23,12 +23,12 @@ const defaultParams: Props = {
|
|
|
23
23
|
<Option value="option14">Test14</Option>,
|
|
24
24
|
<Option value="option15">Test15</Option>,
|
|
25
25
|
<Option value="option16">Test16</Option>,
|
|
26
|
-
<Option value="option17">Test17</Option
|
|
26
|
+
<Option value="option17">Test17</Option>
|
|
27
27
|
],
|
|
28
|
-
value:
|
|
29
|
-
searchInputProps: {
|
|
28
|
+
value: "option1",
|
|
29
|
+
searchInputProps: { "data-testid": "search-input" },
|
|
30
30
|
// @ts-ignore it does exist Typescript, pls.
|
|
31
|
-
selectButtonProps: {
|
|
31
|
+
selectButtonProps: { "data-testid": "select-button" }
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const createSelect = (params?: (defaultParams: Props) => Props) => {
|
|
@@ -37,75 +37,78 @@ const createSelect = (params?: (defaultParams: Props) => Props) => {
|
|
|
37
37
|
parameters = params(defaultParams);
|
|
38
38
|
}
|
|
39
39
|
const queries = render(<SelectComponent {...parameters} data-testid="select" />);
|
|
40
|
-
const select = queries.getByTestId(
|
|
41
|
-
const button = queries.getByTestId(
|
|
40
|
+
const select = queries.getByTestId("select");
|
|
41
|
+
const button = queries.getByTestId("select-button");
|
|
42
42
|
const list = select.querySelector('ul[role="listbox"]');
|
|
43
|
-
const dropdownWrapper = select.querySelector(
|
|
43
|
+
const dropdownWrapper = select.querySelector(".list-wrapper");
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
46
|
...queries,
|
|
47
47
|
select,
|
|
48
48
|
button,
|
|
49
49
|
list,
|
|
50
|
-
dropdownWrapper
|
|
50
|
+
dropdownWrapper
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
describe(
|
|
55
|
-
it(
|
|
56
|
-
const { select, button, list } = createSelect(
|
|
54
|
+
describe("Select should render", () => {
|
|
55
|
+
it("renders with 5 options and proper attributes", () => {
|
|
56
|
+
const { select, button, list, dropdownWrapper } = createSelect(defaultParams => ({
|
|
57
57
|
...defaultParams,
|
|
58
58
|
children: [
|
|
59
59
|
<Option value="option1">Test</Option>,
|
|
60
60
|
<Option value="option2">Test2</Option>,
|
|
61
61
|
<Option value="option3">Test3</Option>,
|
|
62
62
|
<Option value="option4">Test4</Option>,
|
|
63
|
-
<Option value="option5">Test5</Option
|
|
63
|
+
<Option value="option5">Test5</Option>
|
|
64
64
|
],
|
|
65
|
-
placeholder:
|
|
66
|
-
value:
|
|
65
|
+
placeholder: "Placeholder",
|
|
66
|
+
value: ""
|
|
67
67
|
}));
|
|
68
68
|
|
|
69
|
+
expect(dropdownWrapper).toHaveStyle({ "pointer-events": "none" });
|
|
70
|
+
|
|
69
71
|
if (button) {
|
|
70
72
|
userEvent.click(button);
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
expect(select).toBeDefined();
|
|
74
|
-
expect(select.querySelector(
|
|
75
|
-
expect(button?.getAttribute(
|
|
76
|
-
expect(button?.getAttribute(
|
|
76
|
+
expect(select.querySelector(".placeholder")).toBeInTheDocument();
|
|
77
|
+
expect(button?.getAttribute("aria-expanded")).toBe("true");
|
|
78
|
+
expect(button?.getAttribute("aria-disabled")).toBe("false");
|
|
77
79
|
expect(list).toBeDefined();
|
|
78
80
|
expect(list?.querySelectorAll("li[role='option']").length).toBe(5);
|
|
81
|
+
expect(dropdownWrapper).toHaveStyle({ "pointer-events": "auto" });
|
|
79
82
|
});
|
|
80
83
|
|
|
81
|
-
it(
|
|
82
|
-
const { select, button } = createSelect(
|
|
84
|
+
it("should be disabled", () => {
|
|
85
|
+
const { select, button } = createSelect(defaultParams => ({
|
|
83
86
|
...defaultParams,
|
|
84
|
-
disabled: true
|
|
87
|
+
disabled: true
|
|
85
88
|
}));
|
|
86
89
|
|
|
87
|
-
expect(select).toHaveClass(
|
|
88
|
-
expect(button).toHaveAttribute(
|
|
89
|
-
expect(button).toHaveAttribute(
|
|
90
|
+
expect(select).toHaveClass("disabled");
|
|
91
|
+
expect(button).toHaveAttribute("aria-disabled", "true");
|
|
92
|
+
expect(button).toHaveAttribute("disabled");
|
|
90
93
|
});
|
|
91
94
|
|
|
92
|
-
it(
|
|
93
|
-
const { select, button } = createSelect(
|
|
95
|
+
it("should have an error", () => {
|
|
96
|
+
const { select, button } = createSelect(defaultParams => ({
|
|
94
97
|
...defaultParams,
|
|
95
98
|
error: true,
|
|
96
|
-
value:
|
|
99
|
+
value: "option4"
|
|
97
100
|
}));
|
|
98
101
|
|
|
99
|
-
expect(select).toHaveClass(
|
|
100
|
-
expect(button).toHaveAttribute(
|
|
101
|
-
expect(select.querySelector(
|
|
102
|
+
expect(select).toHaveClass("error");
|
|
103
|
+
expect(button).toHaveAttribute("aria-invalid", "true");
|
|
104
|
+
expect(select.querySelector("[data-clear]")).not.toBeInTheDocument();
|
|
102
105
|
});
|
|
103
106
|
});
|
|
104
107
|
|
|
105
|
-
describe(
|
|
106
|
-
it(
|
|
108
|
+
describe("ref should work", () => {
|
|
109
|
+
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
107
110
|
const ExampleComponent = ({
|
|
108
|
-
propagateRef
|
|
111
|
+
propagateRef
|
|
109
112
|
}: {
|
|
110
113
|
propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
|
|
111
114
|
}) => {
|
|
@@ -121,18 +124,18 @@ describe('ref should work', () => {
|
|
|
121
124
|
};
|
|
122
125
|
|
|
123
126
|
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
124
|
-
expect(ref.current!.nodeName).toBe(
|
|
127
|
+
expect(ref.current!.nodeName).toBe("SELECT");
|
|
125
128
|
};
|
|
126
129
|
|
|
127
130
|
render(<ExampleComponent propagateRef={refCheck} />);
|
|
128
131
|
});
|
|
129
132
|
});
|
|
130
133
|
|
|
131
|
-
describe(
|
|
132
|
-
it(
|
|
134
|
+
describe("Select should render with search", () => {
|
|
135
|
+
it("shows the search and filtering works", () => {
|
|
133
136
|
const { select, list, button, getByTestId } = createSelect();
|
|
134
137
|
|
|
135
|
-
const searchInput = getByTestId(
|
|
138
|
+
const searchInput = getByTestId("search-input");
|
|
136
139
|
|
|
137
140
|
if (button) {
|
|
138
141
|
userEvent.click(button);
|
|
@@ -143,82 +146,82 @@ describe('Select should render with search', () => {
|
|
|
143
146
|
expect(list?.querySelectorAll("li[role='option']").length).toBe(17);
|
|
144
147
|
|
|
145
148
|
if (searchInput) {
|
|
146
|
-
userEvent.type(searchInput,
|
|
149
|
+
userEvent.type(searchInput, "17");
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
expect(list?.querySelectorAll("li[role='option']").length).toBe(1);
|
|
150
|
-
expect(list?.querySelector("li[role='option']")?.innerHTML).toBe(
|
|
153
|
+
expect(list?.querySelector("li[role='option']")?.innerHTML).toBe("Test17");
|
|
151
154
|
});
|
|
152
155
|
});
|
|
153
156
|
|
|
154
|
-
describe(
|
|
155
|
-
it(
|
|
157
|
+
describe("Selecting options using keyboard", () => {
|
|
158
|
+
it("should focus through list items and select on enterpress", async () => {
|
|
156
159
|
const onChangeHandler = jest.fn();
|
|
157
|
-
const { select, button } = createSelect(
|
|
160
|
+
const { select, button } = createSelect(defaultParams => ({
|
|
158
161
|
...defaultParams,
|
|
159
|
-
onChange: onChangeHandler
|
|
162
|
+
onChange: onChangeHandler
|
|
160
163
|
}));
|
|
161
164
|
|
|
162
165
|
userEvent.click(button);
|
|
163
166
|
|
|
164
|
-
expect(button).toHaveAttribute(
|
|
167
|
+
expect(button).toHaveAttribute("aria-expanded", "true");
|
|
165
168
|
|
|
166
|
-
userEvent.keyboard(
|
|
167
|
-
userEvent.keyboard(
|
|
168
|
-
userEvent.keyboard(
|
|
169
|
+
userEvent.keyboard("{arrowdown}");
|
|
170
|
+
userEvent.keyboard("{arrowdown}");
|
|
171
|
+
userEvent.keyboard("{enter}");
|
|
169
172
|
|
|
170
|
-
expect(button).toHaveAttribute(
|
|
173
|
+
expect(button).toHaveAttribute("aria-expanded", "false");
|
|
171
174
|
|
|
172
175
|
expect(onChangeHandler).toHaveBeenCalled();
|
|
173
176
|
|
|
174
|
-
userEvent.keyboard(
|
|
177
|
+
userEvent.keyboard("{enter}");
|
|
175
178
|
|
|
176
|
-
expect(button).toHaveAttribute(
|
|
179
|
+
expect(button).toHaveAttribute("aria-expanded", "true");
|
|
177
180
|
|
|
178
|
-
userEvent.keyboard(
|
|
181
|
+
userEvent.keyboard("{arrowdown}");
|
|
179
182
|
|
|
180
183
|
expect(select.querySelector('li[data-value="option3"]')).toHaveFocus();
|
|
181
184
|
|
|
182
|
-
userEvent.keyboard(
|
|
183
|
-
userEvent.keyboard(
|
|
184
|
-
userEvent.keyboard(
|
|
185
|
-
userEvent.keyboard(
|
|
185
|
+
userEvent.keyboard("{arrowup}");
|
|
186
|
+
userEvent.keyboard("{arrowup}");
|
|
187
|
+
userEvent.keyboard("{arrowup}");
|
|
188
|
+
userEvent.keyboard("{arrowup}");
|
|
186
189
|
|
|
187
190
|
expect(select.querySelector('li[data-value="option16"]')).toHaveFocus();
|
|
188
|
-
userEvent.keyboard(
|
|
191
|
+
userEvent.keyboard("{arrowup}");
|
|
189
192
|
expect(select.querySelector('li[data-value="option15"]')).toHaveFocus();
|
|
190
193
|
|
|
191
|
-
userEvent.keyboard(
|
|
192
|
-
userEvent.keyboard(
|
|
193
|
-
userEvent.keyboard(
|
|
194
|
+
userEvent.keyboard("{arrowdown}");
|
|
195
|
+
userEvent.keyboard("{arrowdown}");
|
|
196
|
+
userEvent.keyboard("{arrowdown}");
|
|
194
197
|
|
|
195
198
|
expect(select.querySelector('li[data-value="option1"]')).toHaveFocus();
|
|
196
199
|
|
|
197
|
-
userEvent.keyboard(
|
|
200
|
+
userEvent.keyboard("{escape}");
|
|
198
201
|
|
|
199
|
-
expect(button).toHaveAttribute(
|
|
202
|
+
expect(button).toHaveAttribute("aria-expanded", "false");
|
|
200
203
|
});
|
|
201
204
|
});
|
|
202
205
|
|
|
203
|
-
describe(
|
|
204
|
-
it(
|
|
206
|
+
describe("Expanded should be false whenever we click the body", () => {
|
|
207
|
+
it("closes select on body click", () => {
|
|
205
208
|
const { button } = createSelect();
|
|
206
209
|
|
|
207
210
|
if (button) {
|
|
208
211
|
userEvent.click(button);
|
|
209
212
|
}
|
|
210
213
|
|
|
211
|
-
expect(button).toHaveAttribute(
|
|
214
|
+
expect(button).toHaveAttribute("aria-expanded", "true");
|
|
212
215
|
userEvent.click(document.body);
|
|
213
|
-
expect(button).toHaveAttribute(
|
|
216
|
+
expect(button).toHaveAttribute("aria-expanded", "false");
|
|
214
217
|
});
|
|
215
218
|
});
|
|
216
219
|
|
|
217
|
-
describe(
|
|
218
|
-
it(
|
|
220
|
+
describe("List expansion", () => {
|
|
221
|
+
it("should expand upwards", () => {
|
|
219
222
|
const { select, button, dropdownWrapper } = createSelect();
|
|
220
223
|
|
|
221
|
-
Object.defineProperty(window,
|
|
224
|
+
Object.defineProperty(window, "innerHeight", { value: 500, writable: true });
|
|
222
225
|
|
|
223
226
|
select.getBoundingClientRect = () => ({
|
|
224
227
|
x: 50,
|
|
@@ -229,17 +232,17 @@ describe('List expansion', () => {
|
|
|
229
232
|
left: 250,
|
|
230
233
|
right: 750,
|
|
231
234
|
bottom: 750,
|
|
232
|
-
toJSON: () => jest.fn()
|
|
235
|
+
toJSON: () => jest.fn()
|
|
233
236
|
});
|
|
234
237
|
|
|
235
238
|
if (button) {
|
|
236
239
|
userEvent.click(button);
|
|
237
240
|
}
|
|
238
241
|
|
|
239
|
-
expect(dropdownWrapper).toHaveStyle({ bottom:
|
|
242
|
+
expect(dropdownWrapper).toHaveStyle({ bottom: "0px" });
|
|
240
243
|
});
|
|
241
244
|
|
|
242
|
-
it(
|
|
245
|
+
it("should expand downwards with a max height set", () => {
|
|
243
246
|
const { select, getByRole, dropdownWrapper } = createSelect();
|
|
244
247
|
|
|
245
248
|
dropdownWrapper!.getBoundingClientRect = () => ({
|
|
@@ -251,10 +254,10 @@ describe('List expansion', () => {
|
|
|
251
254
|
left: 250,
|
|
252
255
|
right: 750,
|
|
253
256
|
bottom: 50,
|
|
254
|
-
toJSON: () => jest.fn()
|
|
257
|
+
toJSON: () => jest.fn()
|
|
255
258
|
});
|
|
256
259
|
|
|
257
|
-
Object.defineProperty(window,
|
|
260
|
+
Object.defineProperty(window, "innerHeight", { value: 500, writable: true });
|
|
258
261
|
|
|
259
262
|
select.getBoundingClientRect = () => ({
|
|
260
263
|
x: 50,
|
|
@@ -265,91 +268,91 @@ describe('List expansion', () => {
|
|
|
265
268
|
left: 250,
|
|
266
269
|
right: 750,
|
|
267
270
|
bottom: 50,
|
|
268
|
-
toJSON: () => jest.fn()
|
|
271
|
+
toJSON: () => jest.fn()
|
|
269
272
|
});
|
|
270
273
|
|
|
271
274
|
userEvent.click(document.body);
|
|
272
|
-
const button = getByRole(
|
|
275
|
+
const button = getByRole("button");
|
|
273
276
|
userEvent.click(button);
|
|
274
277
|
|
|
275
|
-
expect(dropdownWrapper).toHaveStyle({ maxHeight:
|
|
276
|
-
expect(dropdownWrapper).toHaveStyle({ top:
|
|
278
|
+
expect(dropdownWrapper).toHaveStyle({ maxHeight: "474px" });
|
|
279
|
+
expect(dropdownWrapper).toHaveStyle({ top: "0px" });
|
|
277
280
|
});
|
|
278
281
|
});
|
|
279
282
|
|
|
280
|
-
describe(
|
|
281
|
-
it(
|
|
283
|
+
describe("onClear method", () => {
|
|
284
|
+
it("should show a cross and fire the passed onClear function with enter", async () => {
|
|
282
285
|
const onClearHandler = jest.fn();
|
|
283
286
|
|
|
284
|
-
const { select, button } = createSelect(
|
|
287
|
+
const { select, button } = createSelect(defaultParams => ({
|
|
285
288
|
...defaultParams,
|
|
286
289
|
onClear: onClearHandler,
|
|
287
|
-
value:
|
|
290
|
+
value: "option4"
|
|
288
291
|
}));
|
|
289
292
|
|
|
290
293
|
button.focus();
|
|
291
|
-
const clearButton = select.querySelector(
|
|
294
|
+
const clearButton = select.querySelector("[data-clear]");
|
|
292
295
|
|
|
293
296
|
userEvent.tab();
|
|
294
297
|
|
|
295
298
|
expect(clearButton).toHaveFocus();
|
|
296
299
|
|
|
297
|
-
userEvent.keyboard(
|
|
300
|
+
userEvent.keyboard("{enter}");
|
|
298
301
|
|
|
299
302
|
expect(onClearHandler).toHaveBeenCalled();
|
|
300
|
-
expect(button?.getAttribute(
|
|
303
|
+
expect(button?.getAttribute("aria-expanded")).toBe("false");
|
|
301
304
|
});
|
|
302
305
|
|
|
303
|
-
it(
|
|
306
|
+
it("should show a cross and fire the passed onClear function with enter", async () => {
|
|
304
307
|
const onClearHandler = jest.fn();
|
|
305
308
|
|
|
306
|
-
const { select, button } = createSelect(
|
|
309
|
+
const { select, button } = createSelect(defaultParams => ({
|
|
307
310
|
...defaultParams,
|
|
308
311
|
onClear: onClearHandler,
|
|
309
|
-
value:
|
|
312
|
+
value: "option4"
|
|
310
313
|
}));
|
|
311
314
|
|
|
312
315
|
button.focus();
|
|
313
|
-
const clearButton = select.querySelector(
|
|
314
|
-
expect(document.querySelector(
|
|
316
|
+
const clearButton = select.querySelector("[data-clear]");
|
|
317
|
+
expect(document.querySelector("[data-display-inner]")).toBeInTheDocument();
|
|
315
318
|
|
|
316
319
|
userEvent.tab();
|
|
317
320
|
|
|
318
321
|
expect(clearButton).toHaveFocus();
|
|
319
322
|
|
|
320
|
-
userEvent.keyboard(
|
|
323
|
+
userEvent.keyboard("{space}");
|
|
321
324
|
|
|
322
325
|
expect(onClearHandler).toHaveBeenCalled();
|
|
323
|
-
expect(button?.getAttribute(
|
|
326
|
+
expect(button?.getAttribute("aria-expanded")).toBe("false");
|
|
324
327
|
});
|
|
325
328
|
|
|
326
|
-
it(
|
|
327
|
-
createSelect(
|
|
329
|
+
it("should not show cross", () => {
|
|
330
|
+
createSelect(defaultParams => ({
|
|
328
331
|
...defaultParams,
|
|
329
|
-
value:
|
|
332
|
+
value: ""
|
|
330
333
|
}));
|
|
331
334
|
|
|
332
|
-
expect(document.querySelector(
|
|
333
|
-
expect(document.querySelector(
|
|
335
|
+
expect(document.querySelector("[data-clear]")).not.toBeInTheDocument();
|
|
336
|
+
expect(document.querySelector("[data-display-inner]")).not.toBeInTheDocument();
|
|
334
337
|
});
|
|
335
338
|
});
|
|
336
339
|
|
|
337
|
-
describe(
|
|
338
|
-
it(
|
|
339
|
-
const { select, button } = createSelect(
|
|
340
|
+
describe("previously selected item", () => {
|
|
341
|
+
it("should have focus", () => {
|
|
342
|
+
const { select, button } = createSelect(defaultParams => ({
|
|
340
343
|
...defaultParams,
|
|
341
|
-
value:
|
|
344
|
+
value: "option4"
|
|
342
345
|
}));
|
|
343
346
|
|
|
344
347
|
button.focus();
|
|
345
348
|
|
|
346
349
|
const option2 = select.querySelector('li[data-value="option2"]')!;
|
|
347
350
|
|
|
348
|
-
userEvent.keyboard(
|
|
349
|
-
expect(button).toHaveAttribute(
|
|
350
|
-
userEvent.keyboard(
|
|
351
|
-
userEvent.keyboard(
|
|
352
|
-
userEvent.keyboard(
|
|
351
|
+
userEvent.keyboard("{enter}");
|
|
352
|
+
expect(button).toHaveAttribute("aria-expanded", "true");
|
|
353
|
+
userEvent.keyboard("{arrowdown}");
|
|
354
|
+
userEvent.keyboard("{arrowdown}");
|
|
355
|
+
userEvent.keyboard("{space}");
|
|
353
356
|
|
|
354
357
|
userEvent.click(button);
|
|
355
358
|
|
|
@@ -357,80 +360,80 @@ describe('previously selected item', () => {
|
|
|
357
360
|
});
|
|
358
361
|
});
|
|
359
362
|
|
|
360
|
-
describe(
|
|
361
|
-
it(
|
|
363
|
+
describe("search input", () => {
|
|
364
|
+
it("listens to different keyboard inputs", async () => {
|
|
362
365
|
const { button, select } = createSelect();
|
|
363
366
|
|
|
364
|
-
const searchInput = document.querySelector(
|
|
367
|
+
const searchInput = document.querySelector(".select-search")!;
|
|
365
368
|
|
|
366
369
|
userEvent.click(button);
|
|
367
370
|
(searchInput as HTMLElement).focus();
|
|
368
371
|
|
|
369
|
-
userEvent.keyboard(
|
|
372
|
+
userEvent.keyboard("{arrowup}");
|
|
370
373
|
expect(select.querySelector('li[data-value="option17"]')).toHaveFocus();
|
|
371
374
|
});
|
|
372
375
|
|
|
373
|
-
it(
|
|
376
|
+
it("move focus with arrowdown", async () => {
|
|
374
377
|
const { button, select } = createSelect();
|
|
375
378
|
|
|
376
|
-
const searchInput = document.querySelector(
|
|
379
|
+
const searchInput = document.querySelector(".select-search")!;
|
|
377
380
|
|
|
378
381
|
userEvent.click(button);
|
|
379
382
|
(searchInput as HTMLElement).focus();
|
|
380
383
|
|
|
381
|
-
userEvent.keyboard(
|
|
384
|
+
userEvent.keyboard("{arrowdown}");
|
|
382
385
|
expect(select.querySelector('li[data-value="option1"]')).toHaveFocus();
|
|
383
386
|
});
|
|
384
387
|
|
|
385
|
-
it(
|
|
388
|
+
it("select with enter", async () => {
|
|
386
389
|
const { button, select } = createSelect();
|
|
387
390
|
|
|
388
|
-
const searchInput = document.querySelector(
|
|
391
|
+
const searchInput = document.querySelector(".select-search")!;
|
|
389
392
|
|
|
390
393
|
userEvent.click(button);
|
|
391
394
|
(searchInput as HTMLElement).focus();
|
|
392
395
|
|
|
393
|
-
userEvent.keyboard(
|
|
396
|
+
userEvent.keyboard("{enter}");
|
|
394
397
|
expect(select.querySelector('li[data-value="option1"]')).toHaveFocus();
|
|
395
398
|
});
|
|
396
399
|
|
|
397
|
-
it(
|
|
400
|
+
it("expand list with arrowdown", async () => {
|
|
398
401
|
const { button } = createSelect();
|
|
399
402
|
|
|
400
403
|
button.focus();
|
|
401
|
-
userEvent.keyboard(
|
|
404
|
+
userEvent.keyboard("{arrowdown}");
|
|
402
405
|
|
|
403
|
-
expect(button).toHaveAttribute(
|
|
406
|
+
expect(button).toHaveAttribute("aria-expanded", "true");
|
|
404
407
|
});
|
|
405
408
|
|
|
406
|
-
it(
|
|
409
|
+
it("expand list with space", async () => {
|
|
407
410
|
const { button } = createSelect();
|
|
408
411
|
|
|
409
412
|
button.focus();
|
|
410
|
-
userEvent.keyboard(
|
|
413
|
+
userEvent.keyboard("{space}");
|
|
411
414
|
|
|
412
|
-
expect(button).toHaveAttribute(
|
|
415
|
+
expect(button).toHaveAttribute("aria-expanded", "true");
|
|
413
416
|
});
|
|
414
417
|
|
|
415
|
-
it(
|
|
418
|
+
it("closes on escape", async () => {
|
|
416
419
|
const { button } = createSelect();
|
|
417
420
|
|
|
418
|
-
const searchInput = document.querySelector(
|
|
421
|
+
const searchInput = document.querySelector(".select-search")!;
|
|
419
422
|
|
|
420
423
|
userEvent.click(button);
|
|
421
424
|
userEvent.tab();
|
|
422
425
|
|
|
423
426
|
await waitFor(() => expect(searchInput).toHaveFocus());
|
|
424
427
|
|
|
425
|
-
userEvent.keyboard(
|
|
428
|
+
userEvent.keyboard("{escape}");
|
|
426
429
|
|
|
427
|
-
expect(button).toHaveAttribute(
|
|
430
|
+
expect(button).toHaveAttribute("aria-expanded", "false");
|
|
428
431
|
});
|
|
429
432
|
|
|
430
|
-
it(
|
|
433
|
+
it("closes on tab", async () => {
|
|
431
434
|
const { button } = createSelect();
|
|
432
435
|
|
|
433
|
-
const searchInput = document.querySelector(
|
|
436
|
+
const searchInput = document.querySelector(".select-search")!;
|
|
434
437
|
|
|
435
438
|
userEvent.click(button);
|
|
436
439
|
userEvent.tab();
|
|
@@ -439,8 +442,8 @@ describe('search input', () => {
|
|
|
439
442
|
});
|
|
440
443
|
});
|
|
441
444
|
|
|
442
|
-
describe(
|
|
443
|
-
it(
|
|
445
|
+
describe("home and end keys work", () => {
|
|
446
|
+
it("goes to home and end", () => {
|
|
444
447
|
const { button } = createSelect();
|
|
445
448
|
|
|
446
449
|
userEvent.click(button);
|
|
@@ -448,22 +451,22 @@ describe('home and end keys work', () => {
|
|
|
448
451
|
const firstOption = document.querySelector('li[data-value="option1"]');
|
|
449
452
|
const lastOption = document.querySelector('li[data-value="option17"]');
|
|
450
453
|
|
|
451
|
-
userEvent.keyboard(
|
|
454
|
+
userEvent.keyboard("{end}");
|
|
452
455
|
|
|
453
456
|
expect(lastOption).toHaveFocus();
|
|
454
|
-
userEvent.keyboard(
|
|
457
|
+
userEvent.keyboard("{home}");
|
|
455
458
|
|
|
456
459
|
expect(firstOption).toHaveFocus();
|
|
457
460
|
});
|
|
458
461
|
});
|
|
459
462
|
|
|
460
|
-
describe(
|
|
461
|
-
it(
|
|
462
|
-
createSelect(
|
|
463
|
+
describe("search input props work", () => {
|
|
464
|
+
it("adds a classname", () => {
|
|
465
|
+
createSelect(defaultParams => ({
|
|
463
466
|
...defaultParams,
|
|
464
|
-
searchInputProps: { wrapperProps: { className:
|
|
467
|
+
searchInputProps: { wrapperProps: { className: "test-wrapper-classname" } }
|
|
465
468
|
}));
|
|
466
469
|
|
|
467
|
-
expect(document.querySelector(
|
|
470
|
+
expect(document.querySelector(".test-wrapper-classname")).toBeInTheDocument();
|
|
468
471
|
});
|
|
469
472
|
});
|