@databricks/design-system 1.12.10 → 1.12.11
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/{DropdownMenu-e0c3fc1d.js → DropdownMenu-eb8788e5.js} +431 -84
- package/dist/DropdownMenu-eb8788e5.js.map +1 -0
- package/dist/{common-31040b66.js → common-5b60d682.js} +3 -1
- package/dist/common-5b60d682.js.map +1 -0
- package/dist/design-system/ApplyGlobalStyles/ApplyGlobalStyles.d.ts +6 -0
- package/dist/design-system/ApplyGlobalStyles/ApplyGlobalStyles.d.ts.map +1 -0
- package/dist/design-system/ApplyGlobalStyles/index.d.ts +2 -0
- package/dist/design-system/ApplyGlobalStyles/index.d.ts.map +1 -0
- package/dist/design-system/Button/Button.d.ts +3 -1
- package/dist/design-system/Button/Button.d.ts.map +1 -1
- package/dist/design-system/Button/styles.d.ts +1 -1
- package/dist/design-system/Button/styles.d.ts.map +1 -1
- package/dist/design-system/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxContent.d.ts +2 -1
- package/dist/design-system/DialogCombobox/DialogComboboxContent.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxFooter.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionControlledList.d.ts +2 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionControlledList.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionList.d.ts +2 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionList.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionListCheckboxItem.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionListSearch.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionListSelectItem.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxSectionHeader.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxSeparator.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxTrigger.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/index.d.ts +2 -1
- package/dist/design-system/DialogCombobox/index.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/shared.d.ts +5 -3
- package/dist/design-system/DialogCombobox/shared.d.ts.map +1 -1
- package/dist/design-system/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/design-system/Empty/Empty.d.ts.map +1 -1
- package/dist/design-system/FormV2/index.d.ts +6 -0
- package/dist/design-system/FormV2/index.d.ts.map +1 -1
- package/dist/design-system/Header/Header.d.ts +2 -2
- package/dist/design-system/Header/Header.d.ts.map +1 -1
- package/dist/design-system/Icon/Icon.d.ts +1 -1
- package/dist/design-system/Icon/Icon.d.ts.map +1 -1
- package/dist/design-system/Icon/__generated/icons/ClockKeyIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/ClockKeyIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/IngestionIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/IngestionIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/QuestionMarkSpeechBubbleIcon.d.ts +4 -0
- package/dist/design-system/Icon/__generated/icons/QuestionMarkSpeechBubbleIcon.d.ts.map +1 -0
- package/dist/design-system/Icon/__generated/icons/index.d.ts +3 -0
- package/dist/design-system/Icon/__generated/icons/index.d.ts.map +1 -1
- package/dist/design-system/Input/Input.d.ts +1 -0
- package/dist/design-system/Input/Input.d.ts.map +1 -1
- package/dist/design-system/LegacyNotification/LegacyNotification.d.ts.map +1 -1
- package/dist/design-system/{Skeleton → LegacySkeleton}/LegacySkeleton.d.ts +2 -1
- package/dist/design-system/LegacySkeleton/LegacySkeleton.d.ts.map +1 -0
- package/dist/design-system/LegacySkeleton/index.d.ts +2 -0
- package/dist/design-system/LegacySkeleton/index.d.ts.map +1 -0
- package/dist/design-system/LoadingState/LoadingState.d.ts +45 -0
- package/dist/design-system/LoadingState/LoadingState.d.ts.map +1 -0
- package/dist/design-system/LoadingState/index.d.ts +2 -0
- package/dist/design-system/LoadingState/index.d.ts.map +1 -0
- package/dist/design-system/Modal/Modal.d.ts +3 -1
- package/dist/design-system/Modal/Modal.d.ts.map +1 -1
- package/dist/design-system/Select/Select.d.ts +4 -3
- package/dist/design-system/Select/Select.d.ts.map +1 -1
- package/dist/design-system/{SkeletonV2 → Skeleton}/GenericSkeleton.d.ts +5 -2
- package/dist/design-system/Skeleton/GenericSkeleton.d.ts.map +1 -0
- package/dist/design-system/{SkeletonV2 → Skeleton}/ParagraphSkeleton.d.ts +5 -2
- package/dist/design-system/Skeleton/ParagraphSkeleton.d.ts.map +1 -0
- package/dist/design-system/{SkeletonV2 → Skeleton}/TableSkeleton.d.ts +3 -2
- package/dist/design-system/Skeleton/TableSkeleton.d.ts.map +1 -0
- package/dist/design-system/Skeleton/TitleSkeleton.d.ts +15 -0
- package/dist/design-system/Skeleton/TitleSkeleton.d.ts.map +1 -0
- package/dist/design-system/Skeleton/index.d.ts +4 -1
- package/dist/design-system/Skeleton/index.d.ts.map +1 -1
- package/dist/design-system/Skeleton/utils.d.ts.map +1 -0
- package/dist/design-system/Spinner/Spinner.d.ts +4 -1
- package/dist/design-system/Spinner/Spinner.d.ts.map +1 -1
- package/dist/design-system/TableUI/TableCell.d.ts +1 -1
- package/dist/design-system/TableUI/TableCell.d.ts.map +1 -1
- package/dist/design-system/TableUI/TableFilterInput.d.ts.map +1 -1
- package/dist/design-system/TableUI/TableFilterLayout.d.ts +1 -1
- package/dist/design-system/TableUI/TableFilterLayout.d.ts.map +1 -1
- package/dist/design-system/TableUI/TableHeader.d.ts +1 -1
- package/dist/design-system/TableUI/TableHeader.d.ts.map +1 -1
- package/dist/design-system/TableUI/TableRow.d.ts +1 -1
- package/dist/design-system/TableUI/TableRow.d.ts.map +1 -1
- package/dist/design-system/TableUI/TableRowAction.d.ts +1 -1
- package/dist/design-system/TableUI/TableRowAction.d.ts.map +1 -1
- package/dist/design-system/TableUI/TableRowSelectCell.d.ts +1 -1
- package/dist/design-system/TableUI/TableRowSelectCell.d.ts.map +1 -1
- package/dist/design-system/TableUI/tableStyles.d.ts +2 -1
- package/dist/design-system/TableUI/tableStyles.d.ts.map +1 -1
- package/dist/design-system/Tabs/index.d.ts +1 -0
- package/dist/design-system/Tabs/index.d.ts.map +1 -1
- package/dist/design-system/Tooltip/InfoTooltip.d.ts +3 -2
- package/dist/design-system/Tooltip/InfoTooltip.d.ts.map +1 -1
- package/dist/design-system/Tooltip/Tooltip.d.ts +8 -0
- package/dist/design-system/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/design-system/TypeaheadCombobox/CountBadge.d.ts +7 -0
- package/dist/design-system/TypeaheadCombobox/CountBadge.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxCheckboxItem.d.ts +11 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxCheckboxItem.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts +11 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxFooter.d.ts +17 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxFooter.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxInput.d.ts +9 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxInput.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxMenu.d.ts +17 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxMenu.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxMenuItem.d.ts +19 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxMenuItem.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxMultiSelectInput.d.ts +16 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxMultiSelectInput.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.d.ts +13 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxSectionHeader.d.ts +2 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxSectionHeader.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.d.ts +13 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxSeparator.d.ts +2 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxSeparator.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxToggleButton.d.ts +12 -0
- package/dist/design-system/TypeaheadCombobox/TypeaheadComboboxToggleButton.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/hooks/downshiftHookWrappers.d.ts +24 -0
- package/dist/design-system/TypeaheadCombobox/hooks/downshiftHookWrappers.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/hooks/index.d.ts +3 -0
- package/dist/design-system/TypeaheadCombobox/hooks/index.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/hooks/useTypeaheadComboboxContext.d.ts +2 -0
- package/dist/design-system/TypeaheadCombobox/hooks/useTypeaheadComboboxContext.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/index.d.ts +13 -0
- package/dist/design-system/TypeaheadCombobox/index.d.ts.map +1 -0
- package/dist/design-system/TypeaheadCombobox/providers/TypeaheadComboboxContext.d.ts +14 -0
- package/dist/design-system/TypeaheadCombobox/providers/TypeaheadComboboxContext.d.ts.map +1 -0
- package/dist/design-system/Typography/Link.d.ts.map +1 -1
- package/dist/design-system/Typography/Paragraph.d.ts.map +1 -1
- package/dist/design-system/Typography/Text.d.ts.map +1 -1
- package/dist/design-system/Typography/Title.d.ts.map +1 -1
- package/dist/design-system/_shared_/Combobox/ClearSelectionButton.d.ts +5 -0
- package/dist/design-system/_shared_/Combobox/ClearSelectionButton.d.ts.map +1 -0
- package/dist/design-system/_shared_/Combobox/EmptyResults.d.ts +2 -0
- package/dist/design-system/_shared_/Combobox/EmptyResults.d.ts.map +1 -0
- package/dist/design-system/_shared_/Combobox/HintRow.d.ts +8 -0
- package/dist/design-system/_shared_/Combobox/HintRow.d.ts.map +1 -0
- package/dist/design-system/_shared_/Combobox/LoadingSpinner.d.ts +2 -0
- package/dist/design-system/_shared_/Combobox/LoadingSpinner.d.ts.map +1 -0
- package/dist/design-system/_shared_/Combobox/SectionHeader.d.ts +2 -0
- package/dist/design-system/_shared_/Combobox/SectionHeader.d.ts.map +1 -0
- package/dist/design-system/_shared_/Combobox/Separator.d.ts +2 -0
- package/dist/design-system/_shared_/Combobox/Separator.d.ts.map +1 -0
- package/dist/design-system/_shared_/Combobox/index.d.ts +8 -0
- package/dist/design-system/_shared_/Combobox/index.d.ts.map +1 -0
- package/dist/design-system/_shared_/Combobox/styles.d.ts +14 -0
- package/dist/design-system/_shared_/Combobox/styles.d.ts.map +1 -0
- package/dist/design-system/_shared_/index.d.ts +2 -0
- package/dist/design-system/_shared_/index.d.ts.map +1 -0
- package/dist/design-system/index.d.ts +4 -1
- package/dist/design-system/index.d.ts.map +1 -1
- package/dist/design-system/types.d.ts +3 -2
- package/dist/design-system/types.d.ts.map +1 -1
- package/dist/design-system/utils/useStableUid.d.ts +2 -0
- package/dist/design-system/utils/useStableUid.d.ts.map +1 -0
- package/dist/design-system/utils/useUniqueId.d.ts +2 -0
- package/dist/design-system/utils/useUniqueId.d.ts.map +1 -0
- package/dist/development.js +2 -1
- package/dist/development.js.map +1 -1
- package/dist/index.js +1949 -627
- package/dist/index.js.map +1 -1
- package/dist/rollup/less.d.ts +0 -1
- package/dist/rollup/less.d.ts.map +1 -1
- package/dist/test-utils/common.d.ts +2 -0
- package/dist/test-utils/common.d.ts.map +1 -1
- package/dist/test-utils/enzyme/index.d.ts +1 -1
- package/dist/test-utils/enzyme/index.d.ts.map +1 -1
- package/dist/test-utils/enzyme/selectEvent.d.ts +13 -7
- package/dist/test-utils/enzyme/selectEvent.d.ts.map +1 -1
- package/dist/test-utils/enzyme/table.d.ts +3 -3
- package/dist/test-utils/enzyme/table.d.ts.map +1 -1
- package/dist/test-utils/enzyme/utils.d.ts +1 -1
- package/dist/test-utils/enzyme/utils.d.ts.map +1 -1
- package/dist/test-utils/enzyme.js +34 -13
- package/dist/test-utils/enzyme.js.map +1 -1
- package/dist/test-utils/rtl/selectEvent.d.ts +6 -0
- package/dist/test-utils/rtl/selectEvent.d.ts.map +1 -1
- package/dist/test-utils/rtl.js +39 -16
- package/dist/test-utils/rtl.js.map +1 -1
- package/dist/theme/colorList.d.ts +32 -0
- package/dist/theme/colorList.d.ts.map +1 -1
- package/dist/theme/colors.d.ts.map +1 -1
- package/package.json +5 -2
- package/dist/DropdownMenu-e0c3fc1d.js.map +0 -1
- package/dist/common-31040b66.js.map +0 -1
- package/dist/design-system/DialogCombobox/DialogComboboxEmpty.d.ts +0 -2
- package/dist/design-system/DialogCombobox/DialogComboboxEmpty.d.ts.map +0 -1
- package/dist/design-system/DialogCombobox/DialogComboboxLoadingSpinner.d.ts +0 -2
- package/dist/design-system/DialogCombobox/DialogComboboxLoadingSpinner.d.ts.map +0 -1
- package/dist/design-system/Skeleton/LegacySkeleton.d.ts.map +0 -1
- package/dist/design-system/SkeletonV2/GenericSkeleton.d.ts.map +0 -1
- package/dist/design-system/SkeletonV2/ParagraphSkeleton.d.ts.map +0 -1
- package/dist/design-system/SkeletonV2/TableSkeleton.d.ts.map +0 -1
- package/dist/design-system/SkeletonV2/TitleSkeleton.d.ts +0 -12
- package/dist/design-system/SkeletonV2/TitleSkeleton.d.ts.map +0 -1
- package/dist/design-system/SkeletonV2/index.d.ts +0 -5
- package/dist/design-system/SkeletonV2/index.d.ts.map +0 -1
- package/dist/design-system/SkeletonV2/utils.d.ts.map +0 -1
- /package/dist/design-system/{SkeletonV2 → Skeleton}/utils.d.ts +0 -0
package/dist/rollup/less.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"less.d.ts","sourceRoot":"","sources":["../../src/rollup/less.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"less.d.ts","sourceRoot":"","sources":["../../src/rollup/less.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,qBAAqB,EAAE,IAAI,CAAC,MAIxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/test-utils/common.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/test-utils/common.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;CAQzB,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,SAAS,EAAE,CAAC,CAAC;CACd;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,UAMtE"}
|
|
@@ -6,5 +6,5 @@ export * from './table';
|
|
|
6
6
|
*
|
|
7
7
|
* @param dropdownButton - The Dropdown Trigger button that opens the menu when clicked.
|
|
8
8
|
*/
|
|
9
|
-
export declare const openDropdownMenu: (dropdownButton: ReactWrapper) => void;
|
|
9
|
+
export declare const openDropdownMenu: <P, S, C>(dropdownButton: ReactWrapper<P, S, C>) => void;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/enzyme/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C,cAAc,SAAS,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/enzyme/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C,cAAc,SAAS,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,0DAE5B,CAAC"}
|
|
@@ -3,16 +3,22 @@ import type { ReactWrapper } from 'enzyme';
|
|
|
3
3
|
* Clicks on the "Clear" button. In order for this function to work properly,
|
|
4
4
|
* the `allowClear` prop must be set to `true`.
|
|
5
5
|
*/
|
|
6
|
-
export declare function clearAll(getSelect: () => ReactWrapper): void;
|
|
6
|
+
export declare function clearAll<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): void;
|
|
7
7
|
/**
|
|
8
8
|
* Closes the dropdown menu for the <Select/> by clicking. Will throw an error if
|
|
9
9
|
* the menu is already closed or if the menu is unable to be closed.
|
|
10
10
|
*/
|
|
11
|
-
export declare function closeMenu(getSelect: () => ReactWrapper): Promise<void>;
|
|
11
|
+
export declare function closeMenu<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Returns a string concatenating the labels for all selected options.
|
|
14
14
|
*/
|
|
15
|
-
export declare function getLabelText(getSelect: () => ReactWrapper): string;
|
|
15
|
+
export declare function getLabelText<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): string;
|
|
16
|
+
/**
|
|
17
|
+
* Removes the `option` by clicking its "X" button. Can only be used with a <Select/>
|
|
18
|
+
* component with `mode="multiple"`. The provided strings must match the option label
|
|
19
|
+
* exactly.
|
|
20
|
+
*/
|
|
21
|
+
export declare function removeMultiSelectOption<P, S, C>(getSelect: () => ReactWrapper<P, S, C>, option: string): void;
|
|
16
22
|
/**
|
|
17
23
|
* Selects options from the dropdown menu for a <Select/> component with `mode="multiple"`.
|
|
18
24
|
* The provided strings must match the option labels exactly. There is a known
|
|
@@ -20,7 +26,7 @@ export declare function getLabelText(getSelect: () => ReactWrapper): string;
|
|
|
20
26
|
* options so not all may options may be rendered in the DOM. If this is causing
|
|
21
27
|
* you issues, please let #help-frontend know.
|
|
22
28
|
*/
|
|
23
|
-
export declare function multiSelect(getSelect: () => ReactWrapper, options: string[]): Promise<void>;
|
|
29
|
+
export declare function multiSelect<P, S, C>(getSelect: () => ReactWrapper<P, S, C>, options: string[]): Promise<void>;
|
|
24
30
|
/**
|
|
25
31
|
* Selects options from the dropdown menu for a <Select/> component without a
|
|
26
32
|
* mode. The provided string must match an option label exactly. There is a known
|
|
@@ -28,15 +34,15 @@ export declare function multiSelect(getSelect: () => ReactWrapper, options: stri
|
|
|
28
34
|
* options so not all may options may be rendered in the DOM. If this is causing
|
|
29
35
|
* you issues, please let #help-frontend know.
|
|
30
36
|
*/
|
|
31
|
-
export declare function singleSelect(getSelect: () => ReactWrapper, option: string): Promise<void>;
|
|
37
|
+
export declare function singleSelect<P, S, C>(getSelect: () => ReactWrapper<P, S, C>, option: string): Promise<void>;
|
|
32
38
|
/**
|
|
33
39
|
* Opens the dropdown menu for the <Select/> by clicking. Will throw an error if
|
|
34
40
|
* the menu is already opened or if the menu is unable to be opened.
|
|
35
41
|
*/
|
|
36
|
-
export declare function openMenu(getSelect: () => ReactWrapper): Promise<void>;
|
|
42
|
+
export declare function openMenu<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): Promise<void>;
|
|
37
43
|
/**
|
|
38
44
|
* Opens the dropdown menu, finds all of the options in the dropdown, closes
|
|
39
45
|
* the menu, and returns a list of the text of each option in order.
|
|
40
46
|
*/
|
|
41
|
-
export declare function getAllOptions(getSelect: () => ReactWrapper): Promise<string[]>;
|
|
47
|
+
export declare function getAllOptions<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): Promise<string[]>;
|
|
42
48
|
//# sourceMappingURL=selectEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectEvent.d.ts","sourceRoot":"","sources":["../../../src/test-utils/enzyme/selectEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAK3C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"selectEvent.d.ts","sourceRoot":"","sources":["../../../src/test-utils/enzyme/selectEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAK3C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAE9E;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAa9F;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAKpF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAM7G;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOnH;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjH;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAa7F;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQtG"}
|
|
@@ -12,7 +12,7 @@ import type { GetTableRowByCellTextOptions, TableRows } from '../common';
|
|
|
12
12
|
* @param columnHeaderName The name of the column to search the text for. If not provided,
|
|
13
13
|
* the first column will be used.
|
|
14
14
|
*/
|
|
15
|
-
export declare function getTableRowByCellText(tableWrapper: ReactWrapper, cellText: string, { columnHeaderName }?: GetTableRowByCellTextOptions): ReactWrapper;
|
|
15
|
+
export declare function getTableRowByCellText<P, S, C>(tableWrapper: ReactWrapper<P, S, C>, cellText: string, { columnHeaderName }?: GetTableRowByCellTextOptions): ReactWrapper;
|
|
16
16
|
/**
|
|
17
17
|
* Converts a Du Bois table to a markdown table string. This means that each cell
|
|
18
18
|
* is separated by a pipe (including the edges), the header row is on its own line
|
|
@@ -49,7 +49,7 @@ export declare function getTableRowByCellText(tableWrapper: ReactWrapper, cellTe
|
|
|
49
49
|
* | Brady | Banana |
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
export declare function toMarkdownTable(tableWrapper: ReactWrapper): string;
|
|
52
|
+
export declare function toMarkdownTable<P, S, C>(tableWrapper: ReactWrapper<P, S, C>): string;
|
|
53
53
|
/**
|
|
54
54
|
* Returns the header row and all body rows (non-header rows) in order. Assumes that the
|
|
55
55
|
* `tableWrapper` has a single header row (as the first row) and the rest of the rows are
|
|
@@ -57,5 +57,5 @@ export declare function toMarkdownTable(tableWrapper: ReactWrapper): string;
|
|
|
57
57
|
*
|
|
58
58
|
* @param tableWrapper The ReactWrapper containing the table to query in.
|
|
59
59
|
*/
|
|
60
|
-
export declare function getTableRows(tableWrapper: ReactWrapper): TableRows<ReactWrapper>;
|
|
60
|
+
export declare function getTableRows<P, S, C>(tableWrapper: ReactWrapper<P, S, C>): TableRows<ReactWrapper>;
|
|
61
61
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/test-utils/enzyme/table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,KAAK,EAAE,4BAA4B,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAIzE;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/test-utils/enzyme/table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,KAAK,EAAE,4BAA4B,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAIzE;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC3C,YAAY,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACnC,QAAQ,EAAE,MAAM,EAChB,EAAE,gBAAgB,EAAE,GAAE,4BAAiC,GACtD,YAAY,CAiDd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAKpF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,CAMlG"}
|
|
@@ -34,6 +34,6 @@ export declare function waitFor<T>(callback: () => T | Promise<T>, options?: Wai
|
|
|
34
34
|
* role of `role` specified. This is similar to `getAllByRole` from @testing-library/react
|
|
35
35
|
* but is much simpler because of the shortcomings of Enzyme's API.
|
|
36
36
|
*/
|
|
37
|
-
export declare function findAllByRole(wrapper: ReactWrapper, role: string): ReactWrapper[];
|
|
37
|
+
export declare function findAllByRole<P, S, C>(wrapper: ReactWrapper<P, S, C>, role: string): ReactWrapper[];
|
|
38
38
|
export {};
|
|
39
39
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/test-utils/enzyme/utils.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,UAAU,YAAY;IACpB,iFAAiF;IACjF,IAAI,CAAC,EAAE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,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAKnG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as selectClasses, c as createMarkdownTable } from '../common-
|
|
1
|
+
import { s as selectClasses, c as createMarkdownTable } from '../common-5b60d682.js';
|
|
2
2
|
import { act } from 'react-dom/test-utils';
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line @databricks/no-restricted-imports-regexp
|
|
@@ -11,7 +11,9 @@ import { act } from 'react-dom/test-utils';
|
|
|
11
11
|
function findByText(wrapper, text, queryOptions) {
|
|
12
12
|
const newWrappers = findAllByText(wrapper, text, queryOptions);
|
|
13
13
|
if (newWrappers.length !== 1) {
|
|
14
|
-
throw new Error(
|
|
14
|
+
throw new Error(
|
|
15
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
16
|
+
`Expected to find 1 node but found ${newWrappers.length} nodes for text "${text}".\n${wrapper.debug()}`);
|
|
15
17
|
}
|
|
16
18
|
return newWrappers[0];
|
|
17
19
|
}
|
|
@@ -34,17 +36,15 @@ function findAllByText(wrapper, text) {
|
|
|
34
36
|
}
|
|
35
37
|
return typeof text === 'string' ? nodeText === text : text.test(nodeText);
|
|
36
38
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return formattedMessageParents.length > 0 ? formattedMessageParents.first() : n;
|
|
43
|
-
} else {
|
|
44
|
-
return n;
|
|
39
|
+
const hostNodes = textNodes.map(n => {
|
|
40
|
+
// Traverse from the text node to the closest DOM node (aka host node)
|
|
41
|
+
let hostNode = n.parents().first();
|
|
42
|
+
while (typeof hostNode.type() !== 'string' && hostNode.parents().length > 0) {
|
|
43
|
+
hostNode = hostNode.parents().first();
|
|
45
44
|
}
|
|
45
|
+
return hostNode;
|
|
46
46
|
});
|
|
47
|
-
return
|
|
47
|
+
return hostNodes;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// We need to keep ref to original setTimeout to avoid SinonJS fake timers if enabled
|
|
@@ -177,12 +177,14 @@ function clearAll(getSelect) {
|
|
|
177
177
|
*/
|
|
178
178
|
async function closeMenu(getSelect) {
|
|
179
179
|
if (!getSelect().find(`.${selectClasses.open}`).exists()) {
|
|
180
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
180
181
|
throw new Error(`Select is already closed\n${getSelect().debug()}`);
|
|
181
182
|
}
|
|
182
183
|
getSelect().find(`.${selectClasses.selector}`).simulate('mousedown');
|
|
183
184
|
await waitFor(() => {
|
|
184
185
|
const select = getSelect();
|
|
185
186
|
if (select.find(`.${selectClasses.open}`).exists()) {
|
|
187
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
186
188
|
throw new Error(`Select did not close\n${select.debug()}`);
|
|
187
189
|
}
|
|
188
190
|
});
|
|
@@ -198,6 +200,17 @@ function getLabelText(getSelect) {
|
|
|
198
200
|
return getSelect().find(`.${selectClasses.selector}`).text().trim();
|
|
199
201
|
}
|
|
200
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Removes the `option` by clicking its "X" button. Can only be used with a <Select/>
|
|
205
|
+
* component with `mode="multiple"`. The provided strings must match the option label
|
|
206
|
+
* exactly.
|
|
207
|
+
*/
|
|
208
|
+
function removeMultiSelectOption(getSelect, option) {
|
|
209
|
+
const optionItem = findByText(getSelect().find(`.${selectClasses.selector}`), option).closest(`.${selectClasses.item}`);
|
|
210
|
+
const removeItem = optionItem.find(`.${selectClasses.removeItem}`).hostNodes();
|
|
211
|
+
removeItem.simulate('click');
|
|
212
|
+
}
|
|
213
|
+
|
|
201
214
|
/**
|
|
202
215
|
* Selects options from the dropdown menu for a <Select/> component with `mode="multiple"`.
|
|
203
216
|
* The provided strings must match the option labels exactly. There is a known
|
|
@@ -233,12 +246,14 @@ async function singleSelect(getSelect, option) {
|
|
|
233
246
|
*/
|
|
234
247
|
async function openMenu(getSelect) {
|
|
235
248
|
if (getSelect().find(`.${selectClasses.open}`).exists()) {
|
|
249
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
236
250
|
throw new Error(`Select is already open\n${getSelect().debug()}`);
|
|
237
251
|
}
|
|
238
252
|
getSelect().find(`.${selectClasses.selector}`).simulate('mousedown');
|
|
239
253
|
await waitFor(() => {
|
|
240
254
|
const select = getSelect();
|
|
241
255
|
if (!select.find(`.${selectClasses.open}`).exists()) {
|
|
256
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
242
257
|
throw new Error(`Select did not open\n${select.debug()}`);
|
|
243
258
|
}
|
|
244
259
|
});
|
|
@@ -263,6 +278,7 @@ var selectEvent = /*#__PURE__*/Object.freeze({
|
|
|
263
278
|
getLabelText: getLabelText,
|
|
264
279
|
multiSelect: multiSelect,
|
|
265
280
|
openMenu: openMenu,
|
|
281
|
+
removeMultiSelectOption: removeMultiSelectOption,
|
|
266
282
|
singleSelect: singleSelect
|
|
267
283
|
});
|
|
268
284
|
|
|
@@ -299,6 +315,7 @@ function getTableRowByCellText(tableWrapper, cellText) {
|
|
|
299
315
|
}
|
|
300
316
|
});
|
|
301
317
|
if (columnHeaderIndex === -1) {
|
|
318
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
302
319
|
throw new Error(`Unable to find a column with name "${columnHeaderName}"\n${tableWrapper.debug()}`);
|
|
303
320
|
}
|
|
304
321
|
}
|
|
@@ -315,10 +332,14 @@ function getTableRowByCellText(tableWrapper, cellText) {
|
|
|
315
332
|
}
|
|
316
333
|
});
|
|
317
334
|
if (matchingRows.length === 0) {
|
|
318
|
-
throw new Error(
|
|
335
|
+
throw new Error(
|
|
336
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
337
|
+
`Unable to find a table row with text "${cellText}" in the column "${columnHeaderName}"\n${tableWrapper.debug()}`);
|
|
319
338
|
}
|
|
320
339
|
if (matchingRows.length > 1) {
|
|
321
|
-
throw new Error(
|
|
340
|
+
throw new Error(
|
|
341
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
342
|
+
`Found multiple table rows with text "${cellText}" in the column "${columnHeaderName}"\n${tableWrapper.debug()}`);
|
|
322
343
|
}
|
|
323
344
|
return matchingRows[0].hostNodes();
|
|
324
345
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enzyme.js","sources":["../../src/test-utils/enzyme/utils.ts","../../src/test-utils/enzyme/selectEvent.ts","../../src/test-utils/enzyme/table.ts","../../src/test-utils/enzyme/index.ts"],"sourcesContent":["// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\nimport { act } from 'react-dom/test-utils';\n\ninterface QueryOptions {\n /** Whether to trim the whitespace from DOM text using `String.prototype.trim` */\n trim?: boolean;\n}\n\n/**\n * Finds a single element that contains the specified text in the wrapper. If\n * there are 0 or more than 1 element that contains the specified text, an error\n * is thrown. Returns the element in an enzyme wrapper.\n */\nexport function findByText<P, S, C>(\n wrapper: ReactWrapper<P, S, C>,\n text: string | RegExp,\n queryOptions?: QueryOptions,\n) {\n const newWrappers = findAllByText<P, S, C>(wrapper, text, queryOptions);\n if (newWrappers.length !== 1) {\n throw new Error(\n `Expected to find 1 node but found ${newWrappers.length} nodes for text \"${text}\".\\n${wrapper.debug()}`,\n );\n }\n return newWrappers[0];\n}\n\n/**\n * Finds all elements that contain the specified text. To avoid duplicate results,\n * only the parents of text nodes are returned.\n */\nexport function findAllByText<P, S, C>(\n wrapper: ReactWrapper<P, S, C>,\n text: string | RegExp,\n { trim = false }: QueryOptions = {},\n) {\n const textNodes = wrapper.findWhere((n) => {\n if (typeof n.type() !== 'string' || n.getDOMNode().children.length !== 0) {\n return false;\n }\n\n let nodeText = n.text();\n if (trim) {\n nodeText = nodeText.trim();\n }\n\n return typeof text === 'string' ? nodeText === text : text.test(nodeText);\n });\n const newWrappers = textNodes.map((n) => {\n if (n.name() === 'FormattedMessage') {\n // Try not to return FormattedMessage since it breaks `simulate` due to a bug in `enzyme-adapter-react-17`\n // Similar to https://github.com/wojtekmaj/enzyme-adapter-react-17/issues/45\n const formattedMessageParents = n.parents();\n return formattedMessageParents.length > 0 ? formattedMessageParents.first() : n;\n } else {\n return n;\n }\n });\n return newWrappers;\n}\n\n// We need to keep ref to original setTimeout to avoid SinonJS fake timers if enabled\nconst originalSetTimeout = window.setTimeout;\n\n/**\n * This is so the stack trace the developer sees is one that's\n * closer to their code (because async stack traces are hard to follow).\n *\n * The code is taken from\n * https://github.com/testing-library/dom-testing-library/blob/f7b5c33c44632fba\n * 1579cb44f9f175be1ec46087/src/wait-for.js#L15-L19\n */\nfunction copyStackTrace(target: Error, source: Error) {\n // eslint-disable-next-line no-param-reassign\n target.stack = source.stack!.replace(source.message, target.message);\n}\n\ninterface WaitForOptions {\n interval?: number;\n stackTraceError?: Error;\n timeout?: number;\n}\n\n/**\n * Run an expectation until it succeeds or reaches the timeout. The timeout of 1500ms\n * is chosen to be under the default Karma test timeout of 2000ms. This function will\n * not work properly if fake timers are being used (since it expects the real setTimeout).\n *\n * The code is taken from\n * https://github.com/TheBrainFamily/wait-for-expect/blob/master/src/index.ts,\n * with slight modifications to support Karma (instead of Jest).\n *\n *\n * Example\n * The <App /> component does not render the header synchronously.\n * Therefore, we cannot check that the wrapper's text is equal to the string\n * immediately--this assertion will fail and cause the test to fail. To\n * remediate this issue, we can run the expectation until it succeeds:\n *\n * function App() {\n * const [value, setValue] = useState(null);\n * useEffect(() => {\n * const timeoutId = setTimeout(() => setValue(\"some value\"), 100);\n * return () => clearTimeout(timeoutId);\n * }, []);\n * return value === null ? null : <h1>The value is: {value}</h1>;\n * }\n *\n * it('renders value', async () => {\n * const wrapper = mount(<App />);\n * await waitFor(() =>\n * wrapper.update();\n * expect(wrapper.text()).to.equal(\"The value is: some value\")\n * );\n * });\n */\nfunction _waitFor<T>(\n f: () => T | Promise<T>,\n { interval = 50, stackTraceError, timeout = 1500 }: WaitForOptions = {},\n): Promise<T> {\n const maxTries = Math.ceil(timeout / interval);\n let tries = 0;\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: Error) => {\n if (tries > maxTries) {\n if (stackTraceError !== undefined) {\n copyStackTrace(error, stackTraceError);\n }\n reject(error);\n return;\n }\n originalSetTimeout(runExpectation, interval);\n };\n\n function runExpectation() {\n tries += 1;\n try {\n Promise.resolve(f()).then(resolve).catch(rejectOrRerun);\n } catch (error) {\n // @ts-expect-error ts-migrate(2571) Object is of type 'unknown'\n rejectOrRerun(error);\n }\n }\n\n originalSetTimeout(runExpectation, 0);\n });\n}\n\n/**\n * Wraps `_waitFor` in React's `act` testing utility. Used when the React component\n * updates during the execution of the callback (either because of indirect effects\n * being run or because of direct requests to update the component, like wrapper.update).\n * Prevents updates related to the callback from being affected by other updates\n * and more closely mimics how React runs in the browser. See\n * https://reactjs.org/docs/test-utils.html#act for more info on `act`.\n */\nexport async function waitFor<T>(callback: () => T | Promise<T>, options?: WaitForOptions): Promise<T> {\n let result: T | Promise<T>;\n // See https://github.com/testing-library/dom-testing-library/blob/f7b5c33c44\n // 632fba1579cb44f9f175be1ec46087/src/wait-for.js#L182-L184\n const stackTraceError = new Error('STACK_TRACE_ERROR');\n\n await act(async () => {\n result = await _waitFor(callback, { stackTraceError, ...options });\n });\n\n // @ts-expect-error: either `waitFor` will throw or `result` will be assigned\n return result;\n}\n\n/**\n * Finds all elements (that are rendered in the DOM) in `wrapper` that have an explicit\n * role of `role` specified. This is similar to `getAllByRole` from @testing-library/react\n * but is much simpler because of the shortcomings of Enzyme's API.\n */\nexport function findAllByRole(wrapper: ReactWrapper, role: string): ReactWrapper[] {\n return wrapper\n .find(`[role=\"${role}\"]`)\n .hostNodes()\n .map((n) => n);\n}\n","// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\n\nimport { selectClasses } from '../common';\nimport { findByText, waitFor } from './utils';\n\n/**\n * Clicks on the \"Clear\" button. In order for this function to work properly,\n * the `allowClear` prop must be set to `true`.\n */\nexport function clearAll(getSelect: () => ReactWrapper): void {\n getSelect().find(`.${selectClasses.clear}`).hostNodes().simulate('mousedown');\n}\n\n/**\n * Closes the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already closed or if the menu is unable to be closed.\n */\nexport async function closeMenu(getSelect: () => ReactWrapper): Promise<void> {\n if (!getSelect().find(`.${selectClasses.open}`).exists()) {\n throw new Error(`Select is already closed\\n${getSelect().debug()}`);\n }\n getSelect().find(`.${selectClasses.selector}`).simulate('mousedown');\n await waitFor(() => {\n const select = getSelect();\n if (select.find(`.${selectClasses.open}`).exists()) {\n throw new Error(`Select did not close\\n${select.debug()}`);\n }\n });\n}\n\n/**\n * Returns a string concatenating the labels for all selected options.\n */\nexport function getLabelText(getSelect: () => ReactWrapper): string {\n // Trim the text to avoid weird whitespace issues non-label elements being added.\n // For example, the input mirror is an empty span with some whitespace that is\n // nested under the selector but does not show up in the label text.\n return getSelect().find(`.${selectClasses.selector}`).text().trim();\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component with `mode=\"multiple\"`.\n * The provided strings must match the option labels exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function multiSelect(getSelect: () => ReactWrapper, options: string[]): Promise<void> {\n await openMenu(getSelect);\n options.forEach((option) => {\n findByText(getSelect().find(`.${selectClasses.list}`), option).simulate('click');\n });\n // Close the menu to indicate that selection has finished\n await closeMenu(getSelect);\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component without a\n * mode. The provided string must match an option label exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function singleSelect(getSelect: () => ReactWrapper, option: string): Promise<void> {\n await openMenu(getSelect);\n findByText(getSelect().find(`.${selectClasses.list}`), option).simulate('click');\n // Menu automatically closes for a single <Select/> (no mode=\"multiple\")\n}\n\n/**\n * Opens the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already opened or if the menu is unable to be opened.\n */\nexport async function openMenu(getSelect: () => ReactWrapper): Promise<void> {\n if (getSelect().find(`.${selectClasses.open}`).exists()) {\n throw new Error(`Select is already open\\n${getSelect().debug()}`);\n }\n getSelect().find(`.${selectClasses.selector}`).simulate('mousedown');\n await waitFor(() => {\n const select = getSelect();\n if (!select.find(`.${selectClasses.open}`).exists()) {\n throw new Error(`Select did not open\\n${select.debug()}`);\n }\n });\n}\n\n/**\n * Opens the dropdown menu, finds all of the options in the dropdown, closes\n * the menu, and returns a list of the text of each option in order.\n */\nexport async function getAllOptions(getSelect: () => ReactWrapper): Promise<string[]> {\n await openMenu(getSelect);\n const options = getSelect()\n .find(`.${selectClasses.list}`)\n .find(`.${selectClasses.option}`)\n .map((option) => option.text());\n await closeMenu(getSelect);\n return options;\n}\n","// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\n\nimport type { GetTableRowByCellTextOptions, TableRows } from '../common';\nimport { createMarkdownTable } from '../common';\nimport { findAllByRole, findByText } from './utils';\n\n/**\n * Returns the table row that contains the specified `cellText`. The `cellText`\n * must be in the column with name `columnHeaderName` if it is specified. Otherwise,\n * the `cellText` must be in the first column. Throws an error if either multiple\n * rows or no rows can be found that match the given options. Also throws an error\n * if the column with name `columnHeaderName` cannot be found.\n *\n * @param tableWrapper The ReactWrapper containing the table to query in.\n * @param cellText The cell text that uniquely identifies the row.\n * @param columnHeaderName The name of the column to search the text for. If not provided,\n * the first column will be used.\n */\nexport function getTableRowByCellText(\n tableWrapper: ReactWrapper,\n cellText: string,\n { columnHeaderName }: GetTableRowByCellTextOptions = {},\n): ReactWrapper {\n let columnHeaderIndex: number;\n if (columnHeaderName === undefined) {\n columnHeaderIndex = 0;\n } else {\n const columnHeaders = findAllByRole(tableWrapper, 'columnheader');\n columnHeaderIndex = columnHeaders.findIndex((n) => {\n try {\n findByText(n, columnHeaderName);\n return true;\n } catch {\n return false;\n }\n });\n if (columnHeaderIndex === -1) {\n throw new Error(`Unable to find a column with name \"${columnHeaderName}\"\\n${tableWrapper.debug()}`);\n }\n }\n\n const matchingRows = findAllByRole(tableWrapper, 'row')\n // Skip first row (table header)\n .slice(1)\n .filter((row) => {\n const cells = findAllByRole(row, 'cell');\n const cell = cells[columnHeaderIndex];\n try {\n findByText(cell, cellText);\n return true;\n } catch {\n return false;\n }\n });\n\n if (matchingRows.length === 0) {\n throw new Error(\n `Unable to find a table row with text \"${cellText}\" in the column \"${columnHeaderName}\"\\n${tableWrapper.debug()}`,\n );\n }\n\n if (matchingRows.length > 1) {\n throw new Error(\n `Found multiple table rows with text \"${cellText}\" in the column \"${columnHeaderName}\"\\n${tableWrapper.debug()}`,\n );\n }\n\n return matchingRows[0].hostNodes();\n}\n\n/**\n * Converts a Du Bois table to a markdown table string. This means that each cell\n * is separated by a pipe (including the edges), the header row is on its own line\n * at the top, each data row is on its own line below, and the header row is separated\n * by a row of dashes from the data rows. This is useful for checking table contents\n * in tests.\n *\n * @param tableWrapper The ReactWrapper containing the table to query in.\n *\n * @example\n * The HTML table:\n * ```jsx\n * <Table>\n * <TableRow isHeader>\n * <TableHeader>Name</TableHeader>\n * <TableHeader>Fruit</TableHeader>\n * </TableRow>\n * <TableRow>\n * <TableCell>Alice</TableCell>\n * <TableCell>Apple</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Brady</TableCell>\n * <TableCell>Banana</TableCell>\n * </TableRow>\n * </Table>\n * ```\n *\n * The Markdown table:\n * ```md\n * | Name | Fruit |\n * | --- | --- |\n * | Alice | Apple |\n * | Brady | Banana |\n * ```\n */\nexport function toMarkdownTable(tableWrapper: ReactWrapper): string {\n const { bodyRows, headerRow } = getTableRows(tableWrapper);\n const columns = findAllByRole(headerRow, 'columnheader').map((column) => column.text());\n const rows = bodyRows.map((row) => findAllByRole(row, 'cell').map((cell) => cell.text()));\n return createMarkdownTable(columns, rows);\n}\n\n/**\n * Returns the header row and all body rows (non-header rows) in order. Assumes that the\n * `tableWrapper` has a single header row (as the first row) and the rest of the rows are\n * body rows.\n *\n * @param tableWrapper The ReactWrapper containing the table to query in.\n */\nexport function getTableRows(tableWrapper: ReactWrapper): TableRows<ReactWrapper> {\n const [firstRow, ...restRows] = findAllByRole(tableWrapper, 'row');\n return {\n bodyRows: restRows,\n headerRow: firstRow,\n };\n}\n","// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\n\nexport * as selectEvent from './selectEvent';\n\nexport * from './table';\n\n/**\n * Open a dropdown menu by simulating a pointerDown event on the dropdown button.\n *\n * @param dropdownButton - The Dropdown Trigger button that opens the menu when clicked.\n */\nexport const openDropdownMenu = (dropdownButton: ReactWrapper) => {\n dropdownButton.hostNodes().simulate('pointerDown', { button: 0, ctrlKey: false });\n};\n"],"names":["findByText","wrapper","text","queryOptions","newWrappers","findAllByText","length","Error","debug","trim","arguments","undefined","textNodes","findWhere","n","type","getDOMNode","children","nodeText","test","map","name","formattedMessageParents","parents","first","originalSetTimeout","window","setTimeout","copyStackTrace","target","source","stack","replace","message","_waitFor","f","interval","stackTraceError","timeout","maxTries","Math","ceil","tries","Promise","resolve","reject","rejectOrRerun","error","runExpectation","then","catch","waitFor","callback","options","result","act","findAllByRole","role","find","hostNodes","clearAll","getSelect","selectClasses","clear","simulate","closeMenu","open","exists","selector","select","getLabelText","multiSelect","openMenu","forEach","option","list","singleSelect","getAllOptions","getTableRowByCellText","tableWrapper","cellText","columnHeaderName","columnHeaderIndex","columnHeaders","findIndex","matchingRows","slice","filter","row","cells","cell","toMarkdownTable","bodyRows","headerRow","getTableRows","columns","column","rows","createMarkdownTable","firstRow","restRows","openDropdownMenu","dropdownButton","button","ctrlKey"],"mappings":";;;AAAA;;AASA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,OAA8B,EAC9BC,IAAq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AKhC,aAAa,CAACgC,GAAG,EAAE,MAAM,CAAC,CAACpE,GAAG,CAAEsE,IAAI,IAAKA,IAAI,CAACxF,IAAI,EAAE,CAAC,CAAC,CAAA;AACzF,EAAA,OAAOgG,mBAAmB,CAACH,OAAO,EAAEE,IAAI,CAAC,CAAA;AAC3C,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASH,YAAYA,CAACf,YAA0B,EAA2B;AAChF,EAAA,MAAM,CAACoB,QAAQ,EAAE,GAAGC,QAAQ,CAAC,GAAG5C,aAAa,CAACuB,YAAY,EAAE,KAAK,CAAC,CAAA;EAClE,OAAO;AACLa,IAAAA,QAAQ,EAAEQ,QAAQ;AAClBP,IAAAA,SAAS,EAAEM,QAAAA;GACZ,CAAA;AACH;;AC/HA;;AAOA;AACA;AACA;AACA;AACA;AACaE,MAAAA,gBAAgB,GAAIC,cAA4B,IAAK;EAChEA,cAAc,CAAC3C,SAAS,EAAE,CAACK,QAAQ,CAAC,aAAa,EAAE;AAAEuC,IAAAA,MAAM,EAAE,CAAC;AAAEC,IAAAA,OAAO,EAAE,KAAA;AAAM,GAAC,CAAC,CAAA;AACnF;;;;"}
|
|
1
|
+
{"version":3,"file":"enzyme.js","sources":["../../src/test-utils/enzyme/utils.ts","../../src/test-utils/enzyme/selectEvent.ts","../../src/test-utils/enzyme/table.ts","../../src/test-utils/enzyme/index.ts"],"sourcesContent":["// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\nimport { act } from 'react-dom/test-utils';\n\ninterface QueryOptions {\n /** Whether to trim the whitespace from DOM text using `String.prototype.trim` */\n trim?: boolean;\n}\n\n/**\n * Finds a single element that contains the specified text in the wrapper. If\n * there are 0 or more than 1 element that contains the specified text, an error\n * is thrown. Returns the element in an enzyme wrapper.\n */\nexport function findByText<P, S, C>(\n wrapper: ReactWrapper<P, S, C>,\n text: string | RegExp,\n queryOptions?: QueryOptions,\n) {\n const newWrappers = findAllByText<P, S, C>(wrapper, text, queryOptions);\n if (newWrappers.length !== 1) {\n throw new Error(\n // eslint-disable-next-line testing-library/no-debugging-utils\n `Expected to find 1 node but found ${newWrappers.length} nodes for text \"${text}\".\\n${wrapper.debug()}`,\n );\n }\n return newWrappers[0];\n}\n\n/**\n * Finds all elements that contain the specified text. To avoid duplicate results,\n * only the parents of text nodes are returned.\n */\nexport function findAllByText<P, S, C>(\n wrapper: ReactWrapper<P, S, C>,\n text: string | RegExp,\n { trim = false }: QueryOptions = {},\n) {\n const textNodes = wrapper.findWhere((n) => {\n if (typeof n.type() !== 'string' || n.getDOMNode().children.length !== 0) {\n return false;\n }\n\n let nodeText = n.text();\n if (trim) {\n nodeText = nodeText.trim();\n }\n\n return typeof text === 'string' ? nodeText === text : text.test(nodeText);\n });\n const hostNodes = textNodes.map((n) => {\n // Traverse from the text node to the closest DOM node (aka host node)\n let hostNode = n.parents().first();\n while (typeof hostNode.type() !== 'string' && hostNode.parents().length > 0) {\n hostNode = hostNode.parents().first();\n }\n return hostNode;\n });\n return hostNodes;\n}\n\n// We need to keep ref to original setTimeout to avoid SinonJS fake timers if enabled\nconst originalSetTimeout = window.setTimeout;\n\n/**\n * This is so the stack trace the developer sees is one that's\n * closer to their code (because async stack traces are hard to follow).\n *\n * The code is taken from\n * https://github.com/testing-library/dom-testing-library/blob/f7b5c33c44632fba\n * 1579cb44f9f175be1ec46087/src/wait-for.js#L15-L19\n */\nfunction copyStackTrace(target: Error, source: Error) {\n // eslint-disable-next-line no-param-reassign\n target.stack = source.stack!.replace(source.message, target.message);\n}\n\ninterface WaitForOptions {\n interval?: number;\n stackTraceError?: Error;\n timeout?: number;\n}\n\n/**\n * Run an expectation until it succeeds or reaches the timeout. The timeout of 1500ms\n * is chosen to be under the default Karma test timeout of 2000ms. This function will\n * not work properly if fake timers are being used (since it expects the real setTimeout).\n *\n * The code is taken from\n * https://github.com/TheBrainFamily/wait-for-expect/blob/master/src/index.ts,\n * with slight modifications to support Karma (instead of Jest).\n *\n *\n * Example\n * The <App /> component does not render the header synchronously.\n * Therefore, we cannot check that the wrapper's text is equal to the string\n * immediately--this assertion will fail and cause the test to fail. To\n * remediate this issue, we can run the expectation until it succeeds:\n *\n * function App() {\n * const [value, setValue] = useState(null);\n * useEffect(() => {\n * const timeoutId = setTimeout(() => setValue(\"some value\"), 100);\n * return () => clearTimeout(timeoutId);\n * }, []);\n * return value === null ? null : <h1>The value is: {value}</h1>;\n * }\n *\n * it('renders value', async () => {\n * const wrapper = mount(<App />);\n * await waitFor(() =>\n * wrapper.update();\n * expect(wrapper.text()).to.equal(\"The value is: some value\")\n * );\n * });\n */\nfunction _waitFor<T>(\n f: () => T | Promise<T>,\n { interval = 50, stackTraceError, timeout = 1500 }: WaitForOptions = {},\n): Promise<T> {\n const maxTries = Math.ceil(timeout / interval);\n let tries = 0;\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: Error) => {\n if (tries > maxTries) {\n if (stackTraceError !== undefined) {\n copyStackTrace(error, stackTraceError);\n }\n reject(error);\n return;\n }\n originalSetTimeout(runExpectation, interval);\n };\n\n function runExpectation() {\n tries += 1;\n try {\n Promise.resolve(f()).then(resolve).catch(rejectOrRerun);\n } catch (error) {\n // @ts-expect-error ts-migrate(2571) Object is of type 'unknown'\n rejectOrRerun(error);\n }\n }\n\n originalSetTimeout(runExpectation, 0);\n });\n}\n\n/**\n * Wraps `_waitFor` in React's `act` testing utility. Used when the React component\n * updates during the execution of the callback (either because of indirect effects\n * being run or because of direct requests to update the component, like wrapper.update).\n * Prevents updates related to the callback from being affected by other updates\n * and more closely mimics how React runs in the browser. See\n * https://reactjs.org/docs/test-utils.html#act for more info on `act`.\n */\nexport async function waitFor<T>(callback: () => T | Promise<T>, options?: WaitForOptions): Promise<T> {\n let result: T | Promise<T>;\n // See https://github.com/testing-library/dom-testing-library/blob/f7b5c33c44\n // 632fba1579cb44f9f175be1ec46087/src/wait-for.js#L182-L184\n const stackTraceError = new Error('STACK_TRACE_ERROR');\n\n await act(async () => {\n result = await _waitFor(callback, { stackTraceError, ...options });\n });\n\n // @ts-expect-error: either `waitFor` will throw or `result` will be assigned\n return result;\n}\n\n/**\n * Finds all elements (that are rendered in the DOM) in `wrapper` that have an explicit\n * role of `role` specified. This is similar to `getAllByRole` from @testing-library/react\n * but is much simpler because of the shortcomings of Enzyme's API.\n */\nexport function findAllByRole<P, S, C>(wrapper: ReactWrapper<P, S, C>, role: string): ReactWrapper[] {\n return wrapper\n .find(`[role=\"${role}\"]`)\n .hostNodes()\n .map((n) => n);\n}\n","// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\n\nimport { selectClasses } from '../common';\nimport { findByText, waitFor } from './utils';\n\n/**\n * Clicks on the \"Clear\" button. In order for this function to work properly,\n * the `allowClear` prop must be set to `true`.\n */\nexport function clearAll<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): void {\n getSelect().find(`.${selectClasses.clear}`).hostNodes().simulate('mousedown');\n}\n\n/**\n * Closes the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already closed or if the menu is unable to be closed.\n */\nexport async function closeMenu<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): Promise<void> {\n if (!getSelect().find(`.${selectClasses.open}`).exists()) {\n // eslint-disable-next-line testing-library/no-debugging-utils\n throw new Error(`Select is already closed\\n${getSelect().debug()}`);\n }\n getSelect().find(`.${selectClasses.selector}`).simulate('mousedown');\n await waitFor(() => {\n const select = getSelect();\n if (select.find(`.${selectClasses.open}`).exists()) {\n // eslint-disable-next-line testing-library/no-debugging-utils\n throw new Error(`Select did not close\\n${select.debug()}`);\n }\n });\n}\n\n/**\n * Returns a string concatenating the labels for all selected options.\n */\nexport function getLabelText<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): string {\n // Trim the text to avoid weird whitespace issues non-label elements being added.\n // For example, the input mirror is an empty span with some whitespace that is\n // nested under the selector but does not show up in the label text.\n return getSelect().find(`.${selectClasses.selector}`).text().trim();\n}\n\n/**\n * Removes the `option` by clicking its \"X\" button. Can only be used with a <Select/>\n * component with `mode=\"multiple\"`. The provided strings must match the option label\n * exactly.\n */\nexport function removeMultiSelectOption<P, S, C>(getSelect: () => ReactWrapper<P, S, C>, option: string): void {\n const optionItem = findByText(getSelect().find(`.${selectClasses.selector}`), option).closest(\n `.${selectClasses.item}`,\n );\n const removeItem = optionItem.find(`.${selectClasses.removeItem}`).hostNodes();\n removeItem.simulate('click');\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component with `mode=\"multiple\"`.\n * The provided strings must match the option labels exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function multiSelect<P, S, C>(getSelect: () => ReactWrapper<P, S, C>, options: string[]): Promise<void> {\n await openMenu(getSelect);\n options.forEach((option) => {\n findByText(getSelect().find(`.${selectClasses.list}`), option).simulate('click');\n });\n // Close the menu to indicate that selection has finished\n await closeMenu(getSelect);\n}\n\n/**\n * Selects options from the dropdown menu for a <Select/> component without a\n * mode. The provided string must match an option label exactly. There is a known\n * limitation for lists that are extremely long because AntD virtualizes the\n * options so not all may options may be rendered in the DOM. If this is causing\n * you issues, please let #help-frontend know.\n */\nexport async function singleSelect<P, S, C>(getSelect: () => ReactWrapper<P, S, C>, option: string): Promise<void> {\n await openMenu(getSelect);\n findByText(getSelect().find(`.${selectClasses.list}`), option).simulate('click');\n // Menu automatically closes for a single <Select/> (no mode=\"multiple\")\n}\n\n/**\n * Opens the dropdown menu for the <Select/> by clicking. Will throw an error if\n * the menu is already opened or if the menu is unable to be opened.\n */\nexport async function openMenu<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): Promise<void> {\n if (getSelect().find(`.${selectClasses.open}`).exists()) {\n // eslint-disable-next-line testing-library/no-debugging-utils\n throw new Error(`Select is already open\\n${getSelect().debug()}`);\n }\n getSelect().find(`.${selectClasses.selector}`).simulate('mousedown');\n await waitFor(() => {\n const select = getSelect();\n if (!select.find(`.${selectClasses.open}`).exists()) {\n // eslint-disable-next-line testing-library/no-debugging-utils\n throw new Error(`Select did not open\\n${select.debug()}`);\n }\n });\n}\n\n/**\n * Opens the dropdown menu, finds all of the options in the dropdown, closes\n * the menu, and returns a list of the text of each option in order.\n */\nexport async function getAllOptions<P, S, C>(getSelect: () => ReactWrapper<P, S, C>): Promise<string[]> {\n await openMenu(getSelect);\n const options = getSelect()\n .find(`.${selectClasses.list}`)\n .find(`.${selectClasses.option}`)\n .map((option) => option.text());\n await closeMenu(getSelect);\n return options;\n}\n","// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\n\nimport type { GetTableRowByCellTextOptions, TableRows } from '../common';\nimport { createMarkdownTable } from '../common';\nimport { findAllByRole, findByText } from './utils';\n\n/**\n * Returns the table row that contains the specified `cellText`. The `cellText`\n * must be in the column with name `columnHeaderName` if it is specified. Otherwise,\n * the `cellText` must be in the first column. Throws an error if either multiple\n * rows or no rows can be found that match the given options. Also throws an error\n * if the column with name `columnHeaderName` cannot be found.\n *\n * @param tableWrapper The ReactWrapper containing the table to query in.\n * @param cellText The cell text that uniquely identifies the row.\n * @param columnHeaderName The name of the column to search the text for. If not provided,\n * the first column will be used.\n */\nexport function getTableRowByCellText<P, S, C>(\n tableWrapper: ReactWrapper<P, S, C>,\n cellText: string,\n { columnHeaderName }: GetTableRowByCellTextOptions = {},\n): ReactWrapper {\n let columnHeaderIndex: number;\n if (columnHeaderName === undefined) {\n columnHeaderIndex = 0;\n } else {\n const columnHeaders = findAllByRole(tableWrapper, 'columnheader');\n columnHeaderIndex = columnHeaders.findIndex((n) => {\n try {\n findByText(n, columnHeaderName);\n return true;\n } catch {\n return false;\n }\n });\n if (columnHeaderIndex === -1) {\n // eslint-disable-next-line testing-library/no-debugging-utils\n throw new Error(`Unable to find a column with name \"${columnHeaderName}\"\\n${tableWrapper.debug()}`);\n }\n }\n\n const matchingRows = findAllByRole(tableWrapper, 'row')\n // Skip first row (table header)\n .slice(1)\n .filter((row) => {\n const cells = findAllByRole(row, 'cell');\n const cell = cells[columnHeaderIndex];\n try {\n findByText(cell, cellText);\n return true;\n } catch {\n return false;\n }\n });\n\n if (matchingRows.length === 0) {\n throw new Error(\n // eslint-disable-next-line testing-library/no-debugging-utils\n `Unable to find a table row with text \"${cellText}\" in the column \"${columnHeaderName}\"\\n${tableWrapper.debug()}`,\n );\n }\n\n if (matchingRows.length > 1) {\n throw new Error(\n // eslint-disable-next-line testing-library/no-debugging-utils\n `Found multiple table rows with text \"${cellText}\" in the column \"${columnHeaderName}\"\\n${tableWrapper.debug()}`,\n );\n }\n\n return matchingRows[0].hostNodes();\n}\n\n/**\n * Converts a Du Bois table to a markdown table string. This means that each cell\n * is separated by a pipe (including the edges), the header row is on its own line\n * at the top, each data row is on its own line below, and the header row is separated\n * by a row of dashes from the data rows. This is useful for checking table contents\n * in tests.\n *\n * @param tableWrapper The ReactWrapper containing the table to query in.\n *\n * @example\n * The HTML table:\n * ```jsx\n * <Table>\n * <TableRow isHeader>\n * <TableHeader>Name</TableHeader>\n * <TableHeader>Fruit</TableHeader>\n * </TableRow>\n * <TableRow>\n * <TableCell>Alice</TableCell>\n * <TableCell>Apple</TableCell>\n * </TableRow>\n * <TableRow>\n * <TableCell>Brady</TableCell>\n * <TableCell>Banana</TableCell>\n * </TableRow>\n * </Table>\n * ```\n *\n * The Markdown table:\n * ```md\n * | Name | Fruit |\n * | --- | --- |\n * | Alice | Apple |\n * | Brady | Banana |\n * ```\n */\nexport function toMarkdownTable<P, S, C>(tableWrapper: ReactWrapper<P, S, C>): string {\n const { bodyRows, headerRow } = getTableRows(tableWrapper);\n const columns = findAllByRole(headerRow, 'columnheader').map((column) => column.text());\n const rows = bodyRows.map((row) => findAllByRole(row, 'cell').map((cell) => cell.text()));\n return createMarkdownTable(columns, rows);\n}\n\n/**\n * Returns the header row and all body rows (non-header rows) in order. Assumes that the\n * `tableWrapper` has a single header row (as the first row) and the rest of the rows are\n * body rows.\n *\n * @param tableWrapper The ReactWrapper containing the table to query in.\n */\nexport function getTableRows<P, S, C>(tableWrapper: ReactWrapper<P, S, C>): TableRows<ReactWrapper> {\n const [firstRow, ...restRows] = findAllByRole(tableWrapper, 'row');\n return {\n bodyRows: restRows,\n headerRow: firstRow,\n };\n}\n","// eslint-disable-next-line @databricks/no-restricted-imports-regexp\nimport type { ReactWrapper } from 'enzyme';\n\nexport * as selectEvent from './selectEvent';\n\nexport * from './table';\n\n/**\n * Open a dropdown menu by simulating a pointerDown event on the dropdown button.\n *\n * @param dropdownButton - The Dropdown Trigger button that opens the menu when clicked.\n */\nexport const openDropdownMenu = <P, S, C>(dropdownButton: ReactWrapper<P, S, C>) => {\n dropdownButton.hostNodes().simulate('pointerDown', { button: 0, ctrlKey: false });\n};\n"],"names":["findByText","wrapper","text","queryOptions","newWrappers","findAllByText","length","Error","debug","trim","arguments","undefined","textNodes","findWhere","n","type","getDOMNode","children","nodeText","test","hostNodes","map","hostNode","parents","first","originalSetTimeout","window","setTimeout","copyStackTrace","target","source","stack","replace","message","_waitFor","f","interval","stackTraceError","timeout","maxTries","Math","ceil","tries","Promise","resolve","reject","rejectOrRerun","error","runExpectation","then","catch","waitFor","callback","options","result","act","findAllByRole","role","find","clearAll","getSelect","selectClasses","clear","simulate","closeMenu","open","exists","selector","select","getLabelText","removeMultiSelectOption","option","optionItem","closest","item","removeItem","multiSelect","openMenu","forEach","list","singleSelect","getAllOptions","getTableRowByCellText","tableWrapper","cellText","columnHeaderName","columnHeaderIndex","columnHeaders","findIndex","matchingRows","slice","filter","row","cells","cell","toMarkdownTable","bodyRows","headerRow","getTableRows","columns","column","rows","createMarkdownTable","firstRow","restRows","openDropdownMenu","dropdownButton","button","ctrlKey"],"mappings":";;;AAAA;;AASA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,CACxBC,OAA8B,EAC9BC,IAAqB,EACrBC,YAA2B,EAC3B;EACA,MAAMC,WAAW,GAAGC,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AAM,EAAE,CAAC;AAAEC,IAAAA,OAAO,EAAE,KAAA;AAAM,GAAC,CAAC,CAAA;AACnF;;;;"}
|
|
@@ -12,6 +12,12 @@ export declare function closeMenu(select: HTMLElement): Promise<void>;
|
|
|
12
12
|
* Returns a string concatenating the labels for all selected options.
|
|
13
13
|
*/
|
|
14
14
|
export declare function getLabelText(select: HTMLElement): string;
|
|
15
|
+
/**
|
|
16
|
+
* Removes the `option` by clicking its "X" button. Can only be used with a <Select/>
|
|
17
|
+
* component with `mode="multiple"`. The provided strings must match the option label
|
|
18
|
+
* exactly.
|
|
19
|
+
*/
|
|
20
|
+
export declare function removeMultiSelectOption(select: HTMLElement, option: string): Promise<void>;
|
|
15
21
|
/**
|
|
16
22
|
* Selects options from the dropdown menu for a <Select/> component with `mode="multiple"`.
|
|
17
23
|
* The provided strings must match the option labels exactly. There is a known
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectEvent.d.ts","sourceRoot":"","sources":["../../../src/test-utils/rtl/selectEvent.ts"],"names":[],"mappings":"AA6CA;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAejE;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAelE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAUxD;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvF;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrF;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjE;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa1E"}
|
|
1
|
+
{"version":3,"file":"selectEvent.d.ts","sourceRoot":"","sources":["../../../src/test-utils/rtl/selectEvent.ts"],"names":[],"mappings":"AA6CA;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAejE;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAelE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAUxD;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAehG;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvF;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrF;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjE;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa1E"}
|
package/dist/test-utils/rtl.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import userEvent from '@testing-library/user-event';
|
|
2
|
-
import { waitFor, within
|
|
3
|
-
import { s as selectClasses, c as createMarkdownTable } from '../common-
|
|
2
|
+
import { queryHelpers, waitFor, within } from '@testing-library/react';
|
|
3
|
+
import { s as selectClasses, c as createMarkdownTable } from '../common-5b60d682.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Allows the helpers in this module to be used when the select element is
|
|
7
|
-
* queried _semantically_ (as if it were a native <select> element)
|
|
8
|
-
* `ByRole('combobox', { name: '
|
|
7
|
+
* queried _semantically_ (as if it were a native <select> element) - i.e.
|
|
8
|
+
* `ByRole('combobox', { name: '...' })`, rather than by test ID.
|
|
9
9
|
*
|
|
10
10
|
* Also checks if <DesignSystemProvider> was used, because many of the helpers
|
|
11
11
|
* in this module query by class name starting with "du-bois-", which requires
|
|
@@ -25,15 +25,15 @@ function getOptionsList(select) {
|
|
|
25
25
|
const input = within(select).getByRole('combobox');
|
|
26
26
|
const listId = input.getAttribute('aria-owns') || input.getAttribute('aria-controls');
|
|
27
27
|
if (!listId) {
|
|
28
|
-
throw
|
|
28
|
+
throw queryHelpers.getElementError('Options input does not control an options list', body);
|
|
29
29
|
}
|
|
30
30
|
const listbox = select.ownerDocument.getElementById(listId);
|
|
31
31
|
if (!(listbox !== null && listbox !== void 0 && listbox.parentElement)) {
|
|
32
|
-
throw
|
|
32
|
+
throw queryHelpers.getElementError('Options listbox does not have a parent', body);
|
|
33
33
|
}
|
|
34
34
|
const optionsList = listbox.parentElement.querySelector(`.${selectClasses.list}`);
|
|
35
35
|
if (!optionsList) {
|
|
36
|
-
throw
|
|
36
|
+
throw queryHelpers.getElementError('Options list not found', body);
|
|
37
37
|
}
|
|
38
38
|
return optionsList;
|
|
39
39
|
}
|
|
@@ -45,18 +45,18 @@ function getOptionsList(select) {
|
|
|
45
45
|
async function openMenu(select) {
|
|
46
46
|
select = getRootElement(select);
|
|
47
47
|
if (select.classList.contains(selectClasses.open)) {
|
|
48
|
-
throw
|
|
48
|
+
throw queryHelpers.getElementError('Select is already open', select);
|
|
49
49
|
}
|
|
50
50
|
const selector = select.querySelector(`.${selectClasses.selector}`);
|
|
51
51
|
if (!selector) {
|
|
52
|
-
throw
|
|
52
|
+
throw queryHelpers.getElementError('Selector not found', select);
|
|
53
53
|
}
|
|
54
54
|
await userEvent.click(selector, {
|
|
55
55
|
pointerEventsCheck: 0
|
|
56
56
|
});
|
|
57
57
|
await waitFor(() => {
|
|
58
58
|
if (!select.classList.contains(selectClasses.open)) {
|
|
59
|
-
throw
|
|
59
|
+
throw queryHelpers.getElementError('Select did not open', select);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -68,18 +68,18 @@ async function openMenu(select) {
|
|
|
68
68
|
async function closeMenu(select) {
|
|
69
69
|
select = getRootElement(select);
|
|
70
70
|
if (!select.classList.contains(selectClasses.open)) {
|
|
71
|
-
throw
|
|
71
|
+
throw queryHelpers.getElementError('Select is already closed', select);
|
|
72
72
|
}
|
|
73
73
|
const selector = select.querySelector(`.${selectClasses.selector}`);
|
|
74
74
|
if (!selector) {
|
|
75
|
-
throw
|
|
75
|
+
throw queryHelpers.getElementError('Selector not found', select);
|
|
76
76
|
}
|
|
77
77
|
await userEvent.click(selector, {
|
|
78
78
|
pointerEventsCheck: 0
|
|
79
79
|
});
|
|
80
80
|
await waitFor(() => {
|
|
81
81
|
if (select.classList.contains(selectClasses.open)) {
|
|
82
|
-
throw
|
|
82
|
+
throw queryHelpers.getElementError('Select did not close', select);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -92,7 +92,7 @@ function getLabelText(select) {
|
|
|
92
92
|
select = getRootElement(select);
|
|
93
93
|
const selector = select.querySelector(`.${selectClasses.selector}`);
|
|
94
94
|
if (!selector) {
|
|
95
|
-
throw
|
|
95
|
+
throw queryHelpers.getElementError('Selector not found', select);
|
|
96
96
|
}
|
|
97
97
|
// Trim the text to avoid weird whitespace issues non-label elements being added.
|
|
98
98
|
// For example, the input mirror is an empty span with some whitespace that is
|
|
@@ -100,6 +100,28 @@ function getLabelText(select) {
|
|
|
100
100
|
return (_selector$textContent = (_selector$textContent2 = selector.textContent) === null || _selector$textContent2 === void 0 ? void 0 : _selector$textContent2.trim()) !== null && _selector$textContent !== void 0 ? _selector$textContent : '';
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Removes the `option` by clicking its "X" button. Can only be used with a <Select/>
|
|
105
|
+
* component with `mode="multiple"`. The provided strings must match the option label
|
|
106
|
+
* exactly.
|
|
107
|
+
*/
|
|
108
|
+
async function removeMultiSelectOption(select, option) {
|
|
109
|
+
select = getRootElement(select);
|
|
110
|
+
const selector = select.querySelector(`.${selectClasses.selector}`);
|
|
111
|
+
if (!selector) {
|
|
112
|
+
throw queryHelpers.getElementError('Selector not found', select);
|
|
113
|
+
}
|
|
114
|
+
const optionItem = within(selector).getByText(option).closest(`.${selectClasses.item}`);
|
|
115
|
+
if (optionItem === null) {
|
|
116
|
+
throw queryHelpers.getElementError(`Option "${option}" not found`, select);
|
|
117
|
+
}
|
|
118
|
+
const removeItem = optionItem.querySelector(`.${selectClasses.removeItem}`);
|
|
119
|
+
if (removeItem === null) {
|
|
120
|
+
throw queryHelpers.getElementError(`Remove button for option "${option}" not found`, optionItem);
|
|
121
|
+
}
|
|
122
|
+
await userEvent.click(removeItem);
|
|
123
|
+
}
|
|
124
|
+
|
|
103
125
|
/**
|
|
104
126
|
* Selects options from the dropdown menu for a <Select/> component with `mode="multiple"`.
|
|
105
127
|
* The provided strings must match the option labels exactly. There is a known
|
|
@@ -148,7 +170,7 @@ async function clearAll(select) {
|
|
|
148
170
|
select = getRootElement(select);
|
|
149
171
|
const clearBtn = select.querySelector(`.${selectClasses.clear}`);
|
|
150
172
|
if (!clearBtn) {
|
|
151
|
-
throw
|
|
173
|
+
throw queryHelpers.getElementError('Select not clearable', select);
|
|
152
174
|
}
|
|
153
175
|
await userEvent.click(clearBtn);
|
|
154
176
|
}
|
|
@@ -164,7 +186,7 @@ async function getAllOptions(select) {
|
|
|
164
186
|
const options = [];
|
|
165
187
|
optionsList.querySelectorAll(`.${selectClasses.option}`).forEach(option => {
|
|
166
188
|
if (option.textContent === null) {
|
|
167
|
-
throw
|
|
189
|
+
throw queryHelpers.getElementError('Option had no text content', option);
|
|
168
190
|
}
|
|
169
191
|
options.push(option.textContent);
|
|
170
192
|
});
|
|
@@ -180,6 +202,7 @@ var selectEvent = /*#__PURE__*/Object.freeze({
|
|
|
180
202
|
getLabelText: getLabelText,
|
|
181
203
|
multiSelect: multiSelect,
|
|
182
204
|
openMenu: openMenu,
|
|
205
|
+
removeMultiSelectOption: removeMultiSelectOption,
|
|
183
206
|
singleSelect: singleSelect
|
|
184
207
|
});
|
|
185
208
|
|