@reltio/components 1.4.1945 → 1.4.1946
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/cjs/AttributeListItem/AttributeListItem.spec.js +4 -4
- package/cjs/AttributesErrorsPanel/components/Error/Error.specs.js +1 -1
- package/cjs/AttributesFiltersBuilder/AttributesFiltersBuilder.test.js +8 -8
- package/cjs/AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.test.js +2 -2
- package/cjs/AttributesFiltersBuilder/components/RowActions/RowActions.test.js +3 -3
- package/cjs/AttributesFiltersButton/AttributesFiltersButton.test.js +1 -1
- package/cjs/AutoSizeList/AutoSizeList.test.js +27 -30
- package/cjs/BasicTable/BasicTable.test.js +26 -5
- package/cjs/BasicTable/IntegrationBasicTable.test.js +16 -5
- package/cjs/BasicTable/helpers.test.js +1 -1
- package/cjs/CollapseRowButton/CollapseRowButton.test.js +3 -3
- package/cjs/CommentsContainer/CommentsContainer.test.js +2 -2
- package/cjs/CustomDateRangeEditor/CustomDateRangeEditor.test.js +2 -2
- package/cjs/DataTypeValue/DataTypeValue.test.js +2 -25
- package/cjs/DataTypeValueEditor/useEditorContext.test.js +2 -2
- package/cjs/DependentLookupEditor/DependentLookupEditor.test.js +116 -70
- package/cjs/DropDownEditor/DropDownEditor.test.js +1 -1
- package/cjs/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js +4 -27
- package/cjs/EditModeAttributesList/EditModeAttributesList.test.js +6 -3
- package/cjs/EditModeAttributesPager/EditModeAttributesPager.js +1 -2
- package/cjs/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +28 -37
- package/cjs/EntitySelector/EntitySelector.test.js +13 -42
- package/cjs/EntitySelector/components/ClearIndicator/ClearIndicator.test.js +1 -1
- package/cjs/EntitySelector/components/EntityOption/EntityOption.test.js +1 -1
- package/cjs/EntitySelector/components/Group/Group.test.js +1 -1
- package/cjs/EntityUriLink/EntityUriLink.test.js +1 -0
- package/cjs/ErrorBoundary/ErrorBoundary.test.js +2 -0
- package/cjs/ExpandedValueTooltip/ExpandedValueTooltip.test.js +4 -1
- package/cjs/FilterButton/FilterButton.test.js +1 -1
- package/cjs/HOCs/withFilter/components/ColumnFilter/ColumnFilter.spec.js +3 -3
- package/cjs/HOCs/withTableContext/withTableContext.test.js +1 -1
- package/cjs/HierarchyNodeTitle/HierarchyNodeTitle.test.js +4 -27
- package/cjs/HierarchyNodeTitle/useEntityDetails.test.js +18 -32
- package/cjs/ImageAttributesGallery/ImageAttributesGallery.test.js +6 -4
- package/cjs/ImageAttributesGallery/components/HeaderRight/HeaderRight.test.js +1 -1
- package/cjs/ImageAttributesLine/ImageAttributesLine.test.js +110 -68
- package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +4 -4
- package/cjs/ImageGalleryDialog/ImageGalleryDialog.specs.js +3 -3
- package/cjs/ImportButton/ImportButton.test.js +1 -1
- package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +1 -1
- package/cjs/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +1 -1
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +3 -3
- package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +31 -22
- package/cjs/LineChart/LineChart.test.js +1 -1
- package/cjs/Link/Link.test.js +1 -0
- package/cjs/LookupEditor/LookupEditor.test.js +3 -3
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +1 -1
- package/cjs/MapChart/MapChart.test.js +3 -3
- package/cjs/MetadataTypesSelector/MetadataTypesSelector.test.js +3 -3
- package/cjs/MoreAttributesButton/MoreAttributesButton.test.js +1 -1
- package/cjs/MultipleInput/MultipleInput.test.js +11 -11
- package/cjs/MultipliableSelect/MultipliableSelect.test.js +14 -8
- package/cjs/NestedAttributeEditor/NestedAttributeEditor.test.js +4 -27
- package/cjs/NumberEditor/NumberEditor.test.js +4 -4
- package/cjs/PieChart/PieChart.test.js +1 -1
- package/cjs/PivotingTooltip/IntegrationPivotingTooltip.test.js +11 -34
- package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +4 -30
- package/cjs/PivotingUriLink/PivotingUriLink.spec.js +1 -0
- package/cjs/ProfileBandNavigation/useSearchNavigation.test.js +3 -3
- package/cjs/ProfilesList/ProfilesList.spec.js +1 -1
- package/cjs/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +1 -1
- package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +6 -30
- package/cjs/RelationEditor/IntegrationRelationEditor.test.js +1 -1
- package/cjs/RelationEditor/RelationEditor.test.js +20 -44
- package/cjs/ReltioMap/ReltioMap.spec.js +10 -8
- package/cjs/ReltioMap/components/EntityMarker/EntityMarker.spec.js +2 -26
- package/cjs/ScrollableTabs/ScrollableTabs.test.js +1 -1
- package/cjs/SearchInput/SearchInput.spec.js +2 -2
- package/cjs/SelectionPopup/SelectionPopup.spec.js +9 -12
- package/cjs/SelectorWithOnlyOptionAutoSelect/SelectorWithOnlyOptionAutoSelect.test.js +4 -4
- package/cjs/ShowLess/ShowLess.test.js +1 -1
- package/cjs/ShowMore/ShowMore.test.js +2 -2
- package/cjs/SideButtonsPanel/SideButtonsPanel.spec.js +3 -3
- package/cjs/SimpleAttribute/IntegrationSimpleAttribute.test.js +15 -34
- package/cjs/SimpleDropDownSelector/SimpleDropDownSelector.test.js +1 -1
- package/cjs/TableWithBars/TableWithBars.test.js +1 -1
- package/cjs/TreeChart/TreeChart.test.js +1 -1
- package/cjs/TypeaheadEditor/TypeaheadEditor.test.js +8 -1
- package/cjs/UploadFileButton/UploadFileButton.spec.js +103 -69
- package/cjs/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +4 -1
- package/cjs/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +3 -1
- package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +2 -2
- package/cjs/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +1 -25
- package/cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +1 -25
- package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +4 -0
- package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +1 -1
- package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +1 -2
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +13 -13
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +5 -5
- package/cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +4 -4
- package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +5 -5
- package/cjs/features/crosswalks/AttributesTable/components/WinnerSourcesRenderer/WinnerSourcesRenderer.test.js +2 -2
- package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.d.ts +2 -2
- package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.js +27 -4
- package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +15 -16
- package/cjs/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +1 -1
- package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +2 -2
- package/cjs/features/crosswalks/hooks/useAttributeActions.test.js +95 -118
- package/cjs/features/crosswalks/hooks/useCrosswalkActions.test.js +38 -61
- package/cjs/features/crosswalks/hooks/useModifiedEntity.test.js +8 -8
- package/cjs/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.test.js +2 -2
- package/cjs/features/history/ContributorsPanel/components/ContributorItem/ContributorItem.specs.js +5 -26
- package/cjs/features/history/HistoryGraph/components/HistoryLink/HistoryLink.specs.js +2 -2
- package/cjs/features/history/HistoryRow/HistoryRow.specs.js +2 -26
- package/cjs/features/history/HistoryTree/HistoryTree.specs.js +1 -1
- package/cjs/features/history/HistoryView/HistoryView.specs.js +1 -1
- package/cjs/features/history/helpers/filters.test.js +6 -6
- package/cjs/features/history/hooks/useHistory.test.js +23 -48
- package/cjs/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +24 -8
- package/cjs/features/workflow/AssigneeSelector/AssigneeSelector.spec.js +1 -26
- package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.spec.js +4 -30
- package/cjs/features/workflow/hooks/useChangeRequest.specs.js +11 -36
- package/cjs/helpers/customScript.test.js +19 -19
- package/cjs/hooks/useAPI/useAPI.test.js +12 -12
- package/cjs/hooks/useBasicTableCellRenderer/CellRenderer.test.js +2 -1
- package/cjs/hooks/useCollapsibleTableRows/dataHelpers.test.js +1 -1
- package/cjs/hooks/useCollapsibleTableRows/useCollapsibleTableRows.test.js +1 -1
- package/cjs/hooks/useConfigPermissions/useConfigPermissions.specs.js +5 -29
- package/cjs/hooks/useCustomScripts/useCustomScripts.test.js +8 -8
- package/cjs/hooks/useLayoutResetter/useLayoutResetter.test.js +8 -8
- package/cjs/hooks/useMarkers/helpers.js +1 -2
- package/cjs/hooks/useReadableSearchState/useReadableSearchState.test.js +14 -44
- package/cjs/hooks/useRelationsLoader/useRelationsLoader.specs.js +3 -4
- package/cjs/hooks/useSavedStateForEntityType/useSavedStateForEntityType.test.js +4 -4
- package/cjs/hooks/useScrollToAttributeError/useScrollToAttributeError.test.js +1 -1
- package/cjs/hooks/useSnackbar/useSnackbar.test.js +24 -17
- package/esm/AttributeListItem/AttributeListItem.spec.js +4 -4
- package/esm/AttributesErrorsPanel/components/Error/Error.specs.js +1 -1
- package/esm/AttributesFiltersBuilder/AttributesFiltersBuilder.test.js +8 -8
- package/esm/AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.test.js +2 -2
- package/esm/AttributesFiltersBuilder/components/RowActions/RowActions.test.js +3 -3
- package/esm/AttributesFiltersButton/AttributesFiltersButton.test.js +1 -1
- package/esm/AutoSizeList/AutoSizeList.test.js +28 -31
- package/esm/BasicTable/BasicTable.test.js +26 -5
- package/esm/BasicTable/IntegrationBasicTable.test.js +17 -6
- package/esm/BasicTable/helpers.test.js +1 -1
- package/esm/CollapseRowButton/CollapseRowButton.test.js +3 -3
- package/esm/CommentsContainer/CommentsContainer.test.js +2 -2
- package/esm/CustomDateRangeEditor/CustomDateRangeEditor.test.js +2 -2
- package/esm/DataTypeValue/DataTypeValue.test.js +2 -2
- package/esm/DataTypeValueEditor/useEditorContext.test.js +2 -2
- package/esm/DependentLookupEditor/DependentLookupEditor.test.js +116 -70
- package/esm/DropDownEditor/DropDownEditor.test.js +1 -1
- package/esm/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js +4 -4
- package/esm/EditModeAttributesList/EditModeAttributesList.test.js +4 -1
- package/esm/EditModeAttributesPager/EditModeAttributesPager.js +1 -2
- package/esm/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +30 -16
- package/esm/EntitySelector/EntitySelector.test.js +13 -19
- package/esm/EntitySelector/components/ClearIndicator/ClearIndicator.test.js +1 -1
- package/esm/EntitySelector/components/EntityOption/EntityOption.test.js +1 -1
- package/esm/EntitySelector/components/Group/Group.test.js +1 -1
- package/esm/EntityUriLink/EntityUriLink.test.js +1 -0
- package/esm/ErrorBoundary/ErrorBoundary.test.js +2 -0
- package/esm/ExpandedValueTooltip/ExpandedValueTooltip.test.js +4 -1
- package/esm/FilterButton/FilterButton.test.js +1 -1
- package/esm/HOCs/withFilter/components/ColumnFilter/ColumnFilter.spec.js +3 -3
- package/esm/HOCs/withTableContext/withTableContext.test.js +1 -1
- package/esm/HierarchyNodeTitle/HierarchyNodeTitle.test.js +4 -4
- package/esm/HierarchyNodeTitle/useEntityDetails.test.js +19 -10
- package/esm/ImageAttributesGallery/ImageAttributesGallery.test.js +6 -4
- package/esm/ImageAttributesGallery/components/HeaderRight/HeaderRight.test.js +1 -1
- package/esm/ImageAttributesLine/ImageAttributesLine.test.js +110 -68
- package/esm/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +4 -4
- package/esm/ImageGalleryDialog/ImageGalleryDialog.specs.js +3 -3
- package/esm/ImportButton/ImportButton.test.js +1 -1
- package/esm/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +1 -1
- package/esm/InlineAttributesPager/components/InlineSimpleAttributesBlock/InlineSimpleAttributesBlock.test.js +1 -1
- package/esm/InlineComplexAttribute/InlineComplexAttribute.test.js +3 -3
- package/esm/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +32 -23
- package/esm/LineChart/LineChart.test.js +1 -1
- package/esm/Link/Link.test.js +1 -0
- package/esm/LookupEditor/LookupEditor.test.js +3 -3
- package/esm/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +1 -1
- package/esm/MapChart/MapChart.test.js +3 -3
- package/esm/MetadataTypesSelector/MetadataTypesSelector.test.js +3 -3
- package/esm/MoreAttributesButton/MoreAttributesButton.test.js +1 -1
- package/esm/MultipleInput/MultipleInput.test.js +11 -11
- package/esm/MultipliableSelect/MultipliableSelect.test.js +14 -8
- package/esm/NestedAttributeEditor/NestedAttributeEditor.test.js +4 -4
- package/esm/NumberEditor/NumberEditor.test.js +4 -4
- package/esm/PieChart/PieChart.test.js +1 -1
- package/esm/PivotingTooltip/IntegrationPivotingTooltip.test.js +11 -11
- package/esm/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +4 -7
- package/esm/PivotingUriLink/PivotingUriLink.spec.js +1 -0
- package/esm/ProfileBandNavigation/useSearchNavigation.test.js +3 -3
- package/esm/ProfilesList/ProfilesList.spec.js +1 -1
- package/esm/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +1 -1
- package/esm/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +7 -8
- package/esm/RelationEditor/IntegrationRelationEditor.test.js +1 -1
- package/esm/RelationEditor/RelationEditor.test.js +21 -22
- package/esm/ReltioMap/ReltioMap.spec.js +11 -9
- package/esm/ReltioMap/components/EntityMarker/EntityMarker.spec.js +3 -4
- package/esm/ScrollableTabs/ScrollableTabs.test.js +1 -1
- package/esm/SearchInput/SearchInput.spec.js +2 -2
- package/esm/SelectionPopup/SelectionPopup.spec.js +9 -12
- package/esm/SelectorWithOnlyOptionAutoSelect/SelectorWithOnlyOptionAutoSelect.test.js +4 -4
- package/esm/ShowLess/ShowLess.test.js +1 -1
- package/esm/ShowMore/ShowMore.test.js +2 -2
- package/esm/SideButtonsPanel/SideButtonsPanel.spec.js +3 -3
- package/esm/SimpleAttribute/IntegrationSimpleAttribute.test.js +16 -12
- package/esm/SimpleDropDownSelector/SimpleDropDownSelector.test.js +1 -1
- package/esm/TableWithBars/TableWithBars.test.js +1 -1
- package/esm/TreeChart/TreeChart.test.js +1 -1
- package/esm/TypeaheadEditor/TypeaheadEditor.test.js +8 -1
- package/esm/UploadFileButton/UploadFileButton.spec.js +103 -69
- package/esm/VerticalHeadingsTable/components/TableCellWithDnd/TableCellWithDnd.test.js +4 -1
- package/esm/VerticalHeadingsTable/components/TableRowWithDnd/TableRowWithDnd.test.js +3 -1
- package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +2 -2
- package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +1 -2
- package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +2 -3
- package/esm/features/activity-log/ActivityLog/ActivityLog.test.js +4 -0
- package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +1 -1
- package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +1 -2
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test.js +13 -13
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +5 -5
- package/esm/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +4 -4
- package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +5 -5
- package/esm/features/crosswalks/AttributesTable/components/WinnerSourcesRenderer/WinnerSourcesRenderer.test.js +2 -2
- package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.d.ts +2 -2
- package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.js +4 -3
- package/esm/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +15 -16
- package/esm/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +1 -1
- package/esm/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +2 -2
- package/esm/features/crosswalks/hooks/useAttributeActions.test.js +95 -95
- package/esm/features/crosswalks/hooks/useCrosswalkActions.test.js +38 -38
- package/esm/features/crosswalks/hooks/useModifiedEntity.test.js +8 -8
- package/esm/features/graph/DataModelGraph/hooks/useEdgeLabelsRenderer.test.js +2 -2
- package/esm/features/history/ContributorsPanel/components/ContributorItem/ContributorItem.specs.js +5 -3
- package/esm/features/history/HistoryGraph/components/HistoryLink/HistoryLink.specs.js +2 -2
- package/esm/features/history/HistoryRow/HistoryRow.specs.js +2 -3
- package/esm/features/history/HistoryTree/HistoryTree.specs.js +1 -1
- package/esm/features/history/HistoryView/HistoryView.specs.js +1 -1
- package/esm/features/history/helpers/filters.test.js +6 -6
- package/esm/features/history/hooks/useHistory.test.js +23 -25
- package/esm/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +25 -9
- package/esm/features/workflow/AssigneeSelector/AssigneeSelector.spec.js +1 -3
- package/esm/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.spec.js +5 -8
- package/esm/features/workflow/hooks/useChangeRequest.specs.js +11 -13
- package/esm/helpers/customScript.test.js +19 -19
- package/esm/hooks/useAPI/useAPI.test.js +12 -12
- package/esm/hooks/useBasicTableCellRenderer/CellRenderer.test.js +2 -1
- package/esm/hooks/useCollapsibleTableRows/dataHelpers.test.js +1 -1
- package/esm/hooks/useCollapsibleTableRows/useCollapsibleTableRows.test.js +1 -1
- package/esm/hooks/useConfigPermissions/useConfigPermissions.specs.js +6 -7
- package/esm/hooks/useCustomScripts/useCustomScripts.test.js +8 -8
- package/esm/hooks/useLayoutResetter/useLayoutResetter.test.js +9 -9
- package/esm/hooks/useMarkers/helpers.js +1 -2
- package/esm/hooks/useReadableSearchState/useReadableSearchState.test.js +8 -15
- package/esm/hooks/useRelationsLoader/useRelationsLoader.specs.js +1 -2
- package/esm/hooks/useSavedStateForEntityType/useSavedStateForEntityType.test.js +4 -4
- package/esm/hooks/useScrollToAttributeError/useScrollToAttributeError.test.js +1 -1
- package/esm/hooks/useSnackbar/useSnackbar.test.js +25 -18
- package/package.json +2 -2
|
@@ -49,7 +49,6 @@ import React from 'react';
|
|
|
49
49
|
import { mount, ReactWrapper, shallow } from 'enzyme';
|
|
50
50
|
import { act } from 'react-dom/test-utils';
|
|
51
51
|
import { debounce } from '@reltio/mdm-sdk';
|
|
52
|
-
import { delayPromise } from '../test-utils';
|
|
53
52
|
import { ReactSelect } from '../ReactSelect';
|
|
54
53
|
import { DependentLookupAutopopulationContext } from '../contexts/DependentLookupAutopopulationContext';
|
|
55
54
|
import { ReactSelectOptionWithCheckIcon } from '../ReactSelectOptionWithCheckIcon';
|
|
@@ -129,7 +128,7 @@ describe('DependentLookupEditor', function () {
|
|
|
129
128
|
wrapper.update();
|
|
130
129
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe(newInputValue);
|
|
131
130
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
132
|
-
expect(props.getLookups).
|
|
131
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
133
132
|
type: 'COUNTRY_CD',
|
|
134
133
|
parents: [],
|
|
135
134
|
displayNamePrefix: newInputValue,
|
|
@@ -142,7 +141,7 @@ describe('DependentLookupEditor', function () {
|
|
|
142
141
|
wrapper.update();
|
|
143
142
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe('');
|
|
144
143
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
145
|
-
expect(props.getLookups).
|
|
144
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
146
145
|
type: 'COUNTRY_CD',
|
|
147
146
|
parents: [],
|
|
148
147
|
displayNamePrefix: '',
|
|
@@ -188,7 +187,7 @@ describe('DependentLookupEditor', function () {
|
|
|
188
187
|
wrapper.update();
|
|
189
188
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe(newInputValue);
|
|
190
189
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
191
|
-
expect(props.getLookups).
|
|
190
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
192
191
|
type: 'COUNTRY_CD',
|
|
193
192
|
parents: [],
|
|
194
193
|
displayNamePrefix: newInputValue,
|
|
@@ -201,7 +200,7 @@ describe('DependentLookupEditor', function () {
|
|
|
201
200
|
wrapper.update();
|
|
202
201
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe(getOptionLabel(value));
|
|
203
202
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
204
|
-
expect(props.getLookups).
|
|
203
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
205
204
|
type: 'COUNTRY_CD',
|
|
206
205
|
parents: [],
|
|
207
206
|
displayNamePrefix: '',
|
|
@@ -223,7 +222,7 @@ describe('DependentLookupEditor', function () {
|
|
|
223
222
|
wrapper.update();
|
|
224
223
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe(newInputValue);
|
|
225
224
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
226
|
-
expect(props.getLookups).
|
|
225
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
227
226
|
type: 'COUNTRY_CD',
|
|
228
227
|
parents: [],
|
|
229
228
|
displayNamePrefix: newInputValue,
|
|
@@ -236,7 +235,7 @@ describe('DependentLookupEditor', function () {
|
|
|
236
235
|
wrapper.update();
|
|
237
236
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe(getOptionLabel(value));
|
|
238
237
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
239
|
-
expect(props.getLookups).
|
|
238
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
240
239
|
type: 'COUNTRY_CD',
|
|
241
240
|
parents: [],
|
|
242
241
|
displayNamePrefix: '',
|
|
@@ -328,7 +327,7 @@ describe('DependentLookupEditor', function () {
|
|
|
328
327
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
329
328
|
return __generator(this, function (_a) {
|
|
330
329
|
switch (_a.label) {
|
|
331
|
-
case 0: return [4 /*yield*/,
|
|
330
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
332
331
|
case 1:
|
|
333
332
|
_a.sent();
|
|
334
333
|
return [2 /*return*/];
|
|
@@ -354,16 +353,13 @@ describe('DependentLookupEditor', function () {
|
|
|
354
353
|
case 2:
|
|
355
354
|
_a.sent();
|
|
356
355
|
// loaded options length is equal to (max + 1) so there are more options exist
|
|
357
|
-
expect(getLookups).
|
|
356
|
+
expect(getLookups).toHaveBeenCalledWith({
|
|
358
357
|
type: props.lookupCode,
|
|
359
358
|
parents: props.parents,
|
|
360
359
|
displayNamePrefix: '',
|
|
361
360
|
max: 3,
|
|
362
361
|
offset: 2
|
|
363
362
|
});
|
|
364
|
-
return [4 /*yield*/, Promise.resolve()];
|
|
365
|
-
case 3:
|
|
366
|
-
_a.sent();
|
|
367
363
|
wrapper.update();
|
|
368
364
|
expect(wrapper.find(ReactSelect).prop('options').length).toBe(4);
|
|
369
365
|
expect(findLoadMoreButton(wrapper).exists()).toBeTruthy();
|
|
@@ -387,7 +383,7 @@ describe('DependentLookupEditor', function () {
|
|
|
387
383
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
388
384
|
return __generator(this, function (_a) {
|
|
389
385
|
switch (_a.label) {
|
|
390
|
-
case 0: return [4 /*yield*/,
|
|
386
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
391
387
|
case 1:
|
|
392
388
|
_a.sent();
|
|
393
389
|
return [2 /*return*/];
|
|
@@ -411,9 +407,6 @@ describe('DependentLookupEditor', function () {
|
|
|
411
407
|
});
|
|
412
408
|
}); })];
|
|
413
409
|
case 2:
|
|
414
|
-
_a.sent();
|
|
415
|
-
return [4 /*yield*/, Promise.resolve()];
|
|
416
|
-
case 3:
|
|
417
410
|
_a.sent();
|
|
418
411
|
wrapper.update();
|
|
419
412
|
expect(wrapper.find(ReactSelect).prop('options').length).toBe(4);
|
|
@@ -477,7 +470,7 @@ describe('DependentLookupEditor', function () {
|
|
|
477
470
|
case 0:
|
|
478
471
|
wrapper = mount(React.createElement(DependentLookupEditor, __assign({}, props)));
|
|
479
472
|
expect(wrapper.find(ReactSelect).prop('options')).toEqual([]);
|
|
480
|
-
expect(props.getLookups).
|
|
473
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
481
474
|
type: props.lookupCode,
|
|
482
475
|
parents: props.parents,
|
|
483
476
|
displayNamePrefix: '',
|
|
@@ -514,7 +507,7 @@ describe('DependentLookupEditor', function () {
|
|
|
514
507
|
wrapper.setProps({
|
|
515
508
|
lookupCode: 'SPEC'
|
|
516
509
|
});
|
|
517
|
-
expect(props.getLookups).
|
|
510
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
518
511
|
type: 'SPEC',
|
|
519
512
|
parents: [],
|
|
520
513
|
displayNamePrefix: '',
|
|
@@ -559,9 +552,9 @@ describe('DependentLookupEditor', function () {
|
|
|
559
552
|
case 1:
|
|
560
553
|
_a.sent();
|
|
561
554
|
wrapper.find('input').simulate('keyDown', { key: 'ArrowDown' });
|
|
562
|
-
expect(props.onChange).not.
|
|
555
|
+
expect(props.onChange).not.toHaveBeenCalled();
|
|
563
556
|
wrapper.find(ReactSelectOptionWithCheckIcon).at(1).find('div').at(0).simulate('click');
|
|
564
|
-
expect(props.onChange).
|
|
557
|
+
expect(props.onChange).toHaveBeenCalledWith({
|
|
565
558
|
value: 'Russia',
|
|
566
559
|
lookupCode: 'RU'
|
|
567
560
|
});
|
|
@@ -569,20 +562,32 @@ describe('DependentLookupEditor', function () {
|
|
|
569
562
|
}
|
|
570
563
|
});
|
|
571
564
|
}); });
|
|
572
|
-
it('should call props.getLookups with correct values on select input change', function () {
|
|
573
|
-
var wrapper
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
565
|
+
it('should call props.getLookups with correct values on select input change', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
566
|
+
var wrapper, newInputValue;
|
|
567
|
+
return __generator(this, function (_a) {
|
|
568
|
+
switch (_a.label) {
|
|
569
|
+
case 0:
|
|
570
|
+
wrapper = mount(React.createElement(DependentLookupEditor, __assign({}, props)));
|
|
571
|
+
newInputValue = 'Ch';
|
|
572
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
573
|
+
return __generator(this, function (_a) {
|
|
574
|
+
wrapper.find('Select').prop('onInputChange')(newInputValue, { action: 'input-change' });
|
|
575
|
+
return [2 /*return*/];
|
|
576
|
+
});
|
|
577
|
+
}); })];
|
|
578
|
+
case 1:
|
|
579
|
+
_a.sent();
|
|
580
|
+
expect(props.getLookups).toHaveBeenCalledWith({
|
|
581
|
+
type: props.lookupCode,
|
|
582
|
+
parents: props.parents,
|
|
583
|
+
displayNamePrefix: newInputValue,
|
|
584
|
+
max: 51,
|
|
585
|
+
offset: 0
|
|
586
|
+
});
|
|
587
|
+
return [2 /*return*/];
|
|
588
|
+
}
|
|
584
589
|
});
|
|
585
|
-
});
|
|
590
|
+
}); });
|
|
586
591
|
it('should call props.getLookups with correct values on select input change and set offset to default', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
587
592
|
var getLookups, value, wrapper, newInputValue, nextNewInputValue;
|
|
588
593
|
return __generator(this, function (_a) {
|
|
@@ -600,7 +605,16 @@ describe('DependentLookupEditor', function () {
|
|
|
600
605
|
act(function () {
|
|
601
606
|
wrapper.find('Select').prop('onInputChange')(newInputValue, { action: 'input-change' });
|
|
602
607
|
});
|
|
603
|
-
return [4 /*yield*/,
|
|
608
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
609
|
+
return __generator(this, function (_a) {
|
|
610
|
+
switch (_a.label) {
|
|
611
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
612
|
+
case 1:
|
|
613
|
+
_a.sent();
|
|
614
|
+
return [2 /*return*/];
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
}); })];
|
|
604
618
|
case 1:
|
|
605
619
|
_a.sent();
|
|
606
620
|
wrapper.update();
|
|
@@ -626,7 +640,7 @@ describe('DependentLookupEditor', function () {
|
|
|
626
640
|
case 2:
|
|
627
641
|
_a.sent();
|
|
628
642
|
// offset === max
|
|
629
|
-
expect(getLookups).
|
|
643
|
+
expect(getLookups).toHaveBeenCalledWith({
|
|
630
644
|
type: props.lookupCode,
|
|
631
645
|
parents: props.parents,
|
|
632
646
|
displayNamePrefix: newInputValue,
|
|
@@ -649,7 +663,7 @@ describe('DependentLookupEditor', function () {
|
|
|
649
663
|
}
|
|
650
664
|
});
|
|
651
665
|
}); });
|
|
652
|
-
|
|
666
|
+
xit('should call props.getLookups with default offset = 0 after LookupCode updated', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
653
667
|
var getLookups, wrapper, newLookupCode;
|
|
654
668
|
return __generator(this, function (_a) {
|
|
655
669
|
switch (_a.label) {
|
|
@@ -661,7 +675,16 @@ describe('DependentLookupEditor', function () {
|
|
|
661
675
|
RU: { displayName: 'Russia' }
|
|
662
676
|
}));
|
|
663
677
|
wrapper = mount(React.createElement(DependentLookupEditor, __assign({}, props, { getLookups: getLookups, max: 2 })));
|
|
664
|
-
return [4 /*yield*/,
|
|
678
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
679
|
+
return __generator(this, function (_a) {
|
|
680
|
+
switch (_a.label) {
|
|
681
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
682
|
+
case 1:
|
|
683
|
+
_a.sent();
|
|
684
|
+
return [2 /*return*/];
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
}); })];
|
|
665
688
|
case 1:
|
|
666
689
|
_a.sent();
|
|
667
690
|
wrapper.update();
|
|
@@ -686,7 +709,7 @@ describe('DependentLookupEditor', function () {
|
|
|
686
709
|
}); })];
|
|
687
710
|
case 2:
|
|
688
711
|
_a.sent();
|
|
689
|
-
expect(getLookups).
|
|
712
|
+
expect(getLookups).toHaveBeenCalledWith({
|
|
690
713
|
type: props.lookupCode,
|
|
691
714
|
parents: props.parents,
|
|
692
715
|
displayNamePrefix: '',
|
|
@@ -722,10 +745,12 @@ describe('DependentLookupEditor', function () {
|
|
|
722
745
|
getLookups.mockReturnValue(Promise.resolve({}));
|
|
723
746
|
wrapper = mount(React.createElement(DependentLookupEditor, __assign({}, props, { getLookups: getLookups })));
|
|
724
747
|
newInputValue = 'Ch';
|
|
725
|
-
act(function () {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
748
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
749
|
+
return __generator(this, function (_a) {
|
|
750
|
+
wrapper.find('Select').prop('onInputChange')(newInputValue, { action: 'input-change' });
|
|
751
|
+
return [2 /*return*/];
|
|
752
|
+
});
|
|
753
|
+
}); })];
|
|
729
754
|
case 1:
|
|
730
755
|
_a.sent();
|
|
731
756
|
wrapper.update();
|
|
@@ -766,16 +791,18 @@ describe('DependentLookupEditor', function () {
|
|
|
766
791
|
wrapper = mount(React.createElement(DependentLookupEditor, __assign({}, props, { getLookups: getLookups, value: value, multiple: false })));
|
|
767
792
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe('USA (US)');
|
|
768
793
|
newInputValue = 'u';
|
|
769
|
-
act(function () {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
794
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
795
|
+
return __generator(this, function (_a) {
|
|
796
|
+
wrapper.find(ReactSelect).prop('onInputChange')(newInputValue, { action: 'input-change' });
|
|
797
|
+
return [2 /*return*/];
|
|
798
|
+
});
|
|
799
|
+
}); })];
|
|
773
800
|
case 1:
|
|
774
801
|
_a.sent();
|
|
775
802
|
wrapper.update();
|
|
776
803
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe(newInputValue);
|
|
777
804
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
778
|
-
expect(getLookups).
|
|
805
|
+
expect(getLookups).toHaveBeenCalledWith({
|
|
779
806
|
type: 'COUNTRY_CD',
|
|
780
807
|
parents: [],
|
|
781
808
|
displayNamePrefix: newInputValue,
|
|
@@ -800,16 +827,18 @@ describe('DependentLookupEditor', function () {
|
|
|
800
827
|
wrapper = mount(React.createElement(DependentLookupEditor, __assign({}, props, { getLookups: getLookups, value: value, multiple: false })));
|
|
801
828
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe('USA (US)');
|
|
802
829
|
newInputValue = '';
|
|
803
|
-
act(function () {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
830
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
831
|
+
return __generator(this, function (_a) {
|
|
832
|
+
wrapper.find(ReactSelect).prop('onInputChange')(newInputValue, { action: 'input-change' });
|
|
833
|
+
return [2 /*return*/];
|
|
834
|
+
});
|
|
835
|
+
}); })];
|
|
807
836
|
case 1:
|
|
808
837
|
_a.sent();
|
|
809
838
|
wrapper.update();
|
|
810
839
|
expect(wrapper.find(ReactSelect).find('Input').last().prop('value')).toBe(newInputValue);
|
|
811
840
|
expect(props.onChange).toHaveBeenCalledWith('');
|
|
812
|
-
expect(getLookups).
|
|
841
|
+
expect(getLookups).toHaveBeenCalledWith({
|
|
813
842
|
type: 'COUNTRY_CD',
|
|
814
843
|
parents: [],
|
|
815
844
|
displayNamePrefix: '',
|
|
@@ -830,7 +859,7 @@ describe('DependentLookupEditor', function () {
|
|
|
830
859
|
};
|
|
831
860
|
var value = { lookupCode: 'DE', value: '' };
|
|
832
861
|
mount(React.createElement(DependentLookupEditor, __assign({}, props, { lookups: lookups, value: value })));
|
|
833
|
-
expect(props.onChange).
|
|
862
|
+
expect(props.onChange).toHaveBeenCalledWith({
|
|
834
863
|
lookupCode: 'DE',
|
|
835
864
|
value: 'Germany'
|
|
836
865
|
});
|
|
@@ -838,20 +867,21 @@ describe('DependentLookupEditor', function () {
|
|
|
838
867
|
it('should call props.resolveLookups if lookup is unresolved and has no resolved value in lookups', function () {
|
|
839
868
|
var value = { lookupCode: 'DE', value: '' };
|
|
840
869
|
mount(React.createElement(DependentLookupEditor, __assign({}, props, { value: value })));
|
|
841
|
-
expect(props.resolveLookups).
|
|
870
|
+
expect(props.resolveLookups).toHaveBeenCalledWith(props.lookupCode, ['DE']);
|
|
842
871
|
});
|
|
843
872
|
it('should call props.resolveLookups once if lookup is unresolved and has no resolved value in lookups and has no resolved value in response', function () {
|
|
844
873
|
var value = { lookupCode: 'DE', value: '' };
|
|
845
874
|
var component = mount(React.createElement(DependentLookupEditor, __assign({}, props, { value: value })));
|
|
846
875
|
component.setProps({ value: __assign({}, value) });
|
|
847
876
|
expect(props.resolveLookups).toHaveBeenCalledTimes(1);
|
|
848
|
-
expect(props.resolveLookups).
|
|
877
|
+
expect(props.resolveLookups).toHaveBeenCalledWith(props.lookupCode, ['DE']);
|
|
849
878
|
});
|
|
850
879
|
it('should use debounced variant of loadOptions on input change', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
851
880
|
var getLookups, component, select;
|
|
852
881
|
return __generator(this, function (_a) {
|
|
853
882
|
switch (_a.label) {
|
|
854
883
|
case 0:
|
|
884
|
+
jest.useFakeTimers();
|
|
855
885
|
debounce.mockImplementation(originalDebounce);
|
|
856
886
|
getLookups = jest.fn().mockReturnValue(Promise.resolve({
|
|
857
887
|
US: { displayName: 'USA' },
|
|
@@ -859,13 +889,16 @@ describe('DependentLookupEditor', function () {
|
|
|
859
889
|
}));
|
|
860
890
|
component = shallow(React.createElement(DependentLookupEditor, __assign({}, props, { getLookups: getLookups })));
|
|
861
891
|
select = component.find(ReactSelect);
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
892
|
+
act(function () {
|
|
893
|
+
select.prop('onInputChange')('u', { action: 'input-change' });
|
|
894
|
+
});
|
|
895
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
896
|
+
return __generator(this, function (_a) {
|
|
897
|
+
jest.advanceTimersByTime(DEBOUNCE_INTERVAL);
|
|
898
|
+
return [2 /*return*/];
|
|
899
|
+
});
|
|
900
|
+
}); })];
|
|
865
901
|
case 1:
|
|
866
|
-
_a.sent();
|
|
867
|
-
return [4 /*yield*/, delayPromise(1)];
|
|
868
|
-
case 2:
|
|
869
902
|
_a.sent();
|
|
870
903
|
expect(getLookups).toHaveBeenCalledTimes(1);
|
|
871
904
|
expect(component.find(ReactSelect).prop('options')).toEqual([
|
|
@@ -876,6 +909,7 @@ describe('DependentLookupEditor', function () {
|
|
|
876
909
|
{ lookupCode: 'US', value: 'USA' }
|
|
877
910
|
]);
|
|
878
911
|
expect(debounce).toHaveBeenCalled();
|
|
912
|
+
jest.useRealTimers();
|
|
879
913
|
return [2 /*return*/];
|
|
880
914
|
}
|
|
881
915
|
});
|
|
@@ -895,7 +929,9 @@ describe('DependentLookupEditor', function () {
|
|
|
895
929
|
];
|
|
896
930
|
var component = shallow(React.createElement(DependentLookupEditor, __assign({}, props, { parents: parents })));
|
|
897
931
|
var select = component.find(ReactSelect);
|
|
898
|
-
|
|
932
|
+
act(function () {
|
|
933
|
+
select.prop('onInputChange')('u', { action: 'input-change' });
|
|
934
|
+
});
|
|
899
935
|
expect(component.prop('isDisabled')).toBeFalsy();
|
|
900
936
|
expect(props.getLookups).toHaveBeenCalledTimes(1);
|
|
901
937
|
expect(props.getLookups).toHaveBeenCalledWith({
|
|
@@ -914,14 +950,15 @@ describe('DependentLookupEditor', function () {
|
|
|
914
950
|
parents = null;
|
|
915
951
|
component = shallow(React.createElement(DependentLookupEditor, __assign({}, props, { parents: parents })));
|
|
916
952
|
select = component.find(ReactSelect);
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
953
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
954
|
+
return __generator(this, function (_a) {
|
|
955
|
+
select.prop('onInputChange')('u', { action: 'input-change' });
|
|
956
|
+
return [2 /*return*/];
|
|
957
|
+
});
|
|
958
|
+
}); })];
|
|
920
959
|
case 1:
|
|
921
960
|
_a.sent();
|
|
922
|
-
|
|
923
|
-
case 2:
|
|
924
|
-
_a.sent();
|
|
961
|
+
expect(props.getLookups).not.toHaveBeenCalled();
|
|
925
962
|
expect(component.find(ReactSelect).prop('options')).toEqual([]);
|
|
926
963
|
return [2 /*return*/];
|
|
927
964
|
}
|
|
@@ -931,7 +968,9 @@ describe('DependentLookupEditor', function () {
|
|
|
931
968
|
var parents = undefined;
|
|
932
969
|
var component = shallow(React.createElement(DependentLookupEditor, __assign({}, props, { parents: parents })));
|
|
933
970
|
var select = component.find(ReactSelect);
|
|
934
|
-
|
|
971
|
+
act(function () {
|
|
972
|
+
select.prop('onInputChange')('u', { action: 'input-change' });
|
|
973
|
+
});
|
|
935
974
|
expect(props.getLookups).toHaveBeenCalledTimes(1);
|
|
936
975
|
expect(props.getLookups).toHaveBeenCalledWith({
|
|
937
976
|
displayNamePrefix: 'u',
|
|
@@ -1084,7 +1123,14 @@ describe('DependentLookupEditor', function () {
|
|
|
1084
1123
|
case 1:
|
|
1085
1124
|
_a.sent();
|
|
1086
1125
|
select = component.find(ReactSelect);
|
|
1087
|
-
|
|
1126
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1127
|
+
return __generator(this, function (_a) {
|
|
1128
|
+
select.prop('onInputChange')('Ru', { action: 'input-change' });
|
|
1129
|
+
return [2 /*return*/];
|
|
1130
|
+
});
|
|
1131
|
+
}); })];
|
|
1132
|
+
case 2:
|
|
1133
|
+
_a.sent();
|
|
1088
1134
|
expect(getLookups).toHaveBeenCalledTimes(2);
|
|
1089
1135
|
expect(props.onChange).not.toHaveBeenCalled();
|
|
1090
1136
|
return [2 /*return*/];
|
|
@@ -28,6 +28,6 @@ describe('DropDownEditor', function () {
|
|
|
28
28
|
var onChange = jest.fn(), value = 'Enum2';
|
|
29
29
|
var wrapper = shallow(React.createElement(DropDownEditor, { onChange: onChange, entries: entries }));
|
|
30
30
|
wrapper.find(MultipliableSelect).simulate('change', value);
|
|
31
|
-
expect(onChange).
|
|
31
|
+
expect(onChange).toHaveBeenCalledWith(value);
|
|
32
32
|
});
|
|
33
33
|
});
|
package/esm/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js
CHANGED
|
@@ -22,12 +22,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
24
|
import { shallow } from 'enzyme';
|
|
25
|
-
import * as mdmSdk from '@reltio/mdm-sdk';
|
|
26
25
|
import { EditModeAttribute } from './EditModeAttribute';
|
|
26
|
+
import { isReltioCrosswalk } from '@reltio/mdm-sdk';
|
|
27
27
|
import { SimpleAttributeEditor } from '../../../SimpleAttributeEditor';
|
|
28
28
|
import { NestedAttributeEditor } from '../../../NestedAttributeEditor';
|
|
29
29
|
import { ReferenceAttributeEditor } from '../../../ReferenceAttributeEditor';
|
|
30
|
-
jest.mock('@reltio/mdm-sdk');
|
|
30
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { isReltioCrosswalk: jest.fn() })); });
|
|
31
31
|
describe('EditModeAttribute', function () {
|
|
32
32
|
it('should render Simple attribute', function () {
|
|
33
33
|
var props = {
|
|
@@ -93,7 +93,7 @@ describe('EditModeAttribute', function () {
|
|
|
93
93
|
errors: [],
|
|
94
94
|
error: {}
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
isReltioCrosswalk.mockReturnValue(true);
|
|
97
97
|
var component = shallow(React.createElement(EditModeAttribute, __assign({}, props)));
|
|
98
98
|
expect(component.find(SimpleAttributeEditor).length).toBe(1);
|
|
99
99
|
expect(component.find(NestedAttributeEditor).length).toBe(0);
|
|
@@ -101,6 +101,6 @@ describe('EditModeAttribute', function () {
|
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
102
102
|
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, crosswalks = props.crosswalks, errors = props.errors, filteredProps = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "crosswalks", "errors"]); //eslint-disable-line no-unused-vars
|
|
103
103
|
expect(component.find(SimpleAttributeEditor).props()).toEqual(__assign(__assign({}, filteredProps), { isReltioCrosswalk: true }));
|
|
104
|
-
expect(
|
|
104
|
+
expect(isReltioCrosswalk).toHaveBeenCalledWith(props.crosswalks, props.attributeValue);
|
|
105
105
|
});
|
|
106
106
|
});
|
|
@@ -20,6 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
};
|
|
21
21
|
import React from 'react';
|
|
22
22
|
import { mount } from 'enzyme';
|
|
23
|
+
import { act } from 'react-dom/test-utils';
|
|
23
24
|
import EditModeAttributesList from './EditModeAttributesList';
|
|
24
25
|
import { MoreAttributesButton } from '../MoreAttributesButton';
|
|
25
26
|
import { EditModeAttributesPager } from '../EditModeAttributesPager';
|
|
@@ -129,7 +130,9 @@ describe('EditModeAttributesList tests', function () {
|
|
|
129
130
|
var component = mount(React.createElement(EditModeAttributesList, { attrTypes: attrTypes, entity: entity, parentUri: parentUri, showEmptyEditors: true }));
|
|
130
131
|
var _b = component.find(HasDeletionsContext.Provider).prop('value'), hasDeletionsMap = _b.hasDeletionsMap, setHasDeletions = _b.setHasDeletions;
|
|
131
132
|
expect(hasDeletionsMap).toEqual({});
|
|
132
|
-
|
|
133
|
+
act(function () {
|
|
134
|
+
setHasDeletions(attrTypes[0].uri, true);
|
|
135
|
+
});
|
|
133
136
|
rerenderWrapper(component);
|
|
134
137
|
expect(component.find(MoreAttributesButton).length).toBe(1);
|
|
135
138
|
expect(component.find(MoreAttributesButton).prop('data')).toEqual([attrTypes[0]]);
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React, { useContext, useMemo } from 'react';
|
|
13
|
-
import { getAttributeErrorByTypeUri, getAttributePagerActiveTypeErrorMessage, getBaseUri, isAttributeTypeError, isImage, isOv, isSpecialAttribute, Mode } from '@reltio/mdm-sdk';
|
|
13
|
+
import { getAttributeErrorByTypeUri, getAttributePagerActiveTypeErrorMessage, getBaseUri, isAttributeTypeError, isImage, isOv, isSpecialAttribute, Mode, filterErrorsForHiddenAttributes } from '@reltio/mdm-sdk';
|
|
14
14
|
import { always, cond, T, partition } from 'ramda';
|
|
15
15
|
import { BranchDecorator } from '../BranchDecorator';
|
|
16
16
|
import { AttributeRenderer } from './components/AttributeRenderer';
|
|
@@ -21,7 +21,6 @@ import { RENDERER_TYPES } from './types';
|
|
|
21
21
|
import { isHighlightedAttributeType, isHighlightedErrorType, ScrollToElementContext } from '../contexts/ScrollToElementContext';
|
|
22
22
|
import { useMdmAction, useMdmActiveErrorsForAttributesPager, useMdmMaxValuesInResponse, useMdmProfileErrors } from '../contexts/MdmModuleContext';
|
|
23
23
|
import { HiddenAttributesContext } from '../contexts/HiddenAttributesContext';
|
|
24
|
-
import { filterErrorsForHiddenAttributes } from '@reltio/mdm-sdk';
|
|
25
24
|
var EditModeAttributesPager = function (_a) {
|
|
26
25
|
var _b;
|
|
27
26
|
var values = _a.values, attributeType = _a.attributeType, _c = _a.mode, mode = _c === void 0 ? Mode.Viewing : _c, crosswalks = _a.crosswalks, drawLines = _a.drawLines, _d = _a.paging, paging = _d === void 0 ? {} : _d, parentUri = _a.parentUri, maxProp = _a.max, showEmptyEditors = _a.showEmptyEditors, showNonOv = _a.showNonOv, highlightedError = _a.highlightedError, highlightedAttribute = _a.highlightedAttribute, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, additionalControlsRenderer = _a.additionalControlsRenderer;
|
|
@@ -47,15 +47,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import React from 'react';
|
|
49
49
|
import userEvent from '@testing-library/user-event';
|
|
50
|
-
import { render, screen, act, waitFor
|
|
50
|
+
import { render, screen, act, waitFor } from '@testing-library/react';
|
|
51
51
|
import { DndProvider } from 'react-dnd';
|
|
52
52
|
import HTML5Backend from 'react-dnd-html5-backend';
|
|
53
|
-
import { ErrorType, Mode, uploadImage } from '@reltio/mdm-sdk';
|
|
54
|
-
import * as mdmSdk from '@reltio/mdm-sdk';
|
|
53
|
+
import { ErrorType, Mode, getAttributesListForEditMode, uploadImage } from '@reltio/mdm-sdk';
|
|
55
54
|
import { EditModeAttributesView } from './EditModeAttributesView';
|
|
56
55
|
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
57
56
|
import { ScrollToElementProvider } from '../contexts/ScrollToElementContext';
|
|
58
|
-
import { delayPromise } from '../test-utils';
|
|
59
57
|
import { getMetadata } from './metadata.test-data';
|
|
60
58
|
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getAttributesListForEditMode: jest.fn(), uploadImage: jest.fn() })); });
|
|
61
59
|
var modifiedEntities = {
|
|
@@ -103,7 +101,6 @@ var defaultProps = {
|
|
|
103
101
|
describe('EditModeAttributesView tests', function () {
|
|
104
102
|
var scrollSpy = jest.fn();
|
|
105
103
|
window.HTMLElement.prototype.scrollIntoView = scrollSpy;
|
|
106
|
-
var getAttributesListForEditModeSpy = jest.spyOn(mdmSdk, 'getAttributesListForEditMode');
|
|
107
104
|
var setUp = function (_a) {
|
|
108
105
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d, _e = _b.userOptions, userOptions = _e === void 0 ? {} : _e;
|
|
109
106
|
var user = userEvent.setup(userOptions);
|
|
@@ -127,7 +124,7 @@ describe('EditModeAttributesView tests', function () {
|
|
|
127
124
|
return __generator(this, function (_b) {
|
|
128
125
|
switch (_b.label) {
|
|
129
126
|
case 0:
|
|
130
|
-
|
|
127
|
+
getAttributesListForEditMode.mockReturnValue([
|
|
131
128
|
{
|
|
132
129
|
attrType: {
|
|
133
130
|
label: 'FirstLevelNestedSub1_HCP',
|
|
@@ -162,7 +159,7 @@ describe('EditModeAttributesView tests', function () {
|
|
|
162
159
|
})];
|
|
163
160
|
case 4:
|
|
164
161
|
_b.sent();
|
|
165
|
-
expect(scrollSpy).
|
|
162
|
+
expect(scrollSpy).toHaveBeenCalledTimes(1);
|
|
166
163
|
act(function () {
|
|
167
164
|
jest.runOnlyPendingTimers();
|
|
168
165
|
});
|
|
@@ -186,7 +183,7 @@ describe('EditModeAttributesView tests', function () {
|
|
|
186
183
|
}
|
|
187
184
|
];
|
|
188
185
|
beforeEach(function () {
|
|
189
|
-
|
|
186
|
+
getAttributesListForEditMode.mockReturnValue([
|
|
190
187
|
{
|
|
191
188
|
attrType: {
|
|
192
189
|
label: 'Image Gallery',
|
|
@@ -199,17 +196,24 @@ describe('EditModeAttributesView tests', function () {
|
|
|
199
196
|
}
|
|
200
197
|
]);
|
|
201
198
|
});
|
|
202
|
-
it('should render required and missed image attribute in edit mode correctly', function () {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
199
|
+
it('should render required and missed image attribute in edit mode correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
setUp({ mdmValues: __assign(__assign({}, defaultMdmValues), { profileErrors: profileErrors }) });
|
|
202
|
+
expect(screen.getByText('*')).toBeInTheDocument();
|
|
203
|
+
expect(screen.getByText('Attribute is required')).toBeInTheDocument();
|
|
204
|
+
return [2 /*return*/];
|
|
205
|
+
});
|
|
206
|
+
}); });
|
|
207
207
|
it('should deactivate error for required and missed image attribute after image was added', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
-
var user, file;
|
|
208
|
+
var resolveUploadImage, user, file;
|
|
209
209
|
return __generator(this, function (_a) {
|
|
210
210
|
switch (_a.label) {
|
|
211
211
|
case 0:
|
|
212
|
-
uploadImage.mockImplementation(function () {
|
|
212
|
+
uploadImage.mockImplementation(function () {
|
|
213
|
+
return new Promise(function (resolve) {
|
|
214
|
+
resolveUploadImage = resolve;
|
|
215
|
+
});
|
|
216
|
+
});
|
|
213
217
|
user = setUp({
|
|
214
218
|
mdmValues: __assign(__assign({}, defaultMdmValues), { profileErrors: profileErrors }),
|
|
215
219
|
userOptions: { delay: null, applyAccept: false }
|
|
@@ -224,9 +228,19 @@ describe('EditModeAttributesView tests', function () {
|
|
|
224
228
|
return [4 /*yield*/, screen.findByTestId('reltio-linear-load-indicator')];
|
|
225
229
|
case 3:
|
|
226
230
|
_a.sent();
|
|
227
|
-
return [4 /*yield*/,
|
|
231
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0: return [4 /*yield*/, resolveUploadImage('Image')];
|
|
235
|
+
case 1:
|
|
236
|
+
_a.sent();
|
|
237
|
+
return [2 /*return*/];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}); })];
|
|
228
241
|
case 4:
|
|
229
242
|
_a.sent();
|
|
243
|
+
expect(screen.queryByTestId('reltio-linear-load-indicator')).not.toBeInTheDocument();
|
|
230
244
|
expect(mdmActions.errorDeactivated).toHaveBeenCalledWith('configuration/entityTypes/HCP/attributes/ImageGallery--entities/1E4APrQW');
|
|
231
245
|
return [2 /*return*/];
|
|
232
246
|
}
|