@reltio/components 1.4.2050 → 1.4.2052
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/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/ChartTooltip/ChartTooltip.js +3 -3
- package/ColumnsSettings/ColumnsSettings.d.ts +2 -1
- package/ColumnsSettings/ColumnsSettings.js +2 -2
- package/ColumnsSettings/ColumnsSettings.test.js +14 -0
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
- package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
- package/DropDownMenuButton/DropDownMenuButton.js +1 -1
- package/HOCs/withAsyncMount/withAsyncMount.test.js +52 -52
- package/IgnoreButton/IgnoreButton.spec.js +109 -20
- package/Image/Image.d.ts +1 -1
- package/Image/Image.js +8 -8
- package/Image/Image.test.js +46 -51
- package/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
- package/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
- package/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
- package/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
- package/ImageAttributesLine/ImageAttributesLine.js +1 -1
- package/ImageAttributesLine/ImageAttributesLine.test.js +187 -193
- package/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
- package/ImageAttributesLine/imageAttributeValues.test-data.js +22 -0
- package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +315 -298
- package/ImageDetailsView/ImageDetailsView.test.js +529 -55
- package/ImageDetailsView/attributes.test-data.d.ts +4 -1
- package/ImageDetailsView/attributes.test-data.js +98 -1
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
- package/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
- package/ImageDetailsView/helpers.test.js +4 -4
- package/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
- package/ImportButton/ImportButton.test.js +94 -24
- package/InlineAttributesList/InlineAttributesList.test.js +22 -62
- package/InlineAttributesList/attributes.test-data.d.ts +4 -2
- package/InlineAttributesList/attributes.test-data.js +40 -1
- package/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
- package/InlineAttributesPager/InlineAttributesPager.js +1 -4
- package/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
- package/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
- package/InlineComplexAttribute/InlineComplexAttribute.test.js +396 -182
- package/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
- package/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
- package/InlineReferenceAttribute/InlineReferenceAttribute.test.js +165 -107
- package/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +352 -346
- package/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +285 -194
- package/InternalLink/InternalLink.test.js +41 -11
- package/LookupEditor/LookupEditor.test.js +180 -44
- package/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
- package/MapChart/MapChart.js +3 -8
- package/MapChart/MapChart.test.js +152 -188
- package/MapChart/components/Legend/Legend.js +3 -3
- package/MaskingSwitcher/MaskingSwitcher.js +1 -1
- package/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
- package/SelectEditor/SelectEditor.d.ts +4 -10
- package/SelectEditor/SelectEditor.js +0 -4
- package/SelectEditor/SelectEditor.test.js +79 -9
- package/SelectionPopup/SelectionPopup.d.ts +2 -1
- package/SelectionPopup/SelectionPopup.js +3 -3
- package/SelectionPopup/SelectionPopup.spec.js +90 -30
- package/cjs/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/cjs/ChartTooltip/ChartTooltip.js +3 -3
- package/cjs/ColumnsSettings/ColumnsSettings.d.ts +2 -1
- package/cjs/ColumnsSettings/ColumnsSettings.js +2 -2
- package/cjs/ColumnsSettings/ColumnsSettings.test.js +14 -0
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
- package/cjs/DropDownMenuButton/DropDownMenuButton.js +1 -1
- package/cjs/HOCs/withAsyncMount/withAsyncMount.test.js +56 -56
- package/cjs/IgnoreButton/IgnoreButton.spec.js +109 -20
- package/cjs/Image/Image.d.ts +1 -1
- package/cjs/Image/Image.js +8 -8
- package/cjs/Image/Image.test.js +46 -51
- package/cjs/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
- package/cjs/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
- package/cjs/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
- package/cjs/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
- package/cjs/ImageAttributesLine/ImageAttributesLine.js +1 -1
- package/cjs/ImageAttributesLine/ImageAttributesLine.test.js +195 -224
- package/cjs/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
- package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +23 -1
- package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +316 -299
- package/cjs/ImageDetailsView/ImageDetailsView.test.js +529 -55
- package/cjs/ImageDetailsView/attributes.test-data.d.ts +4 -1
- package/cjs/ImageDetailsView/attributes.test-data.js +99 -2
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
- package/cjs/ImageDetailsView/helpers.test.js +3 -3
- package/cjs/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
- package/cjs/ImportButton/ImportButton.test.js +94 -24
- package/cjs/InlineAttributesList/InlineAttributesList.test.js +22 -62
- package/cjs/InlineAttributesList/attributes.test-data.d.ts +4 -2
- package/cjs/InlineAttributesList/attributes.test-data.js +41 -2
- package/cjs/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
- package/cjs/InlineAttributesPager/InlineAttributesPager.js +1 -4
- package/cjs/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +395 -204
- package/cjs/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
- package/cjs/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
- package/cjs/InlineReferenceAttribute/InlineReferenceAttribute.test.js +164 -106
- package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +351 -345
- package/cjs/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +307 -193
- package/cjs/InternalLink/InternalLink.test.js +40 -10
- package/cjs/LookupEditor/LookupEditor.test.js +178 -65
- package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
- package/cjs/MapChart/MapChart.js +3 -8
- package/cjs/MapChart/MapChart.test.js +152 -188
- package/cjs/MapChart/components/Legend/Legend.js +3 -3
- package/cjs/MaskingSwitcher/MaskingSwitcher.js +1 -1
- package/cjs/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
- package/cjs/SelectEditor/SelectEditor.d.ts +4 -10
- package/cjs/SelectEditor/SelectEditor.js +0 -4
- package/cjs/SelectEditor/SelectEditor.test.js +79 -9
- package/cjs/SelectionPopup/SelectionPopup.d.ts +2 -1
- package/cjs/SelectionPopup/SelectionPopup.js +3 -3
- package/cjs/SelectionPopup/SelectionPopup.spec.js +90 -30
- package/cjs/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
- package/cjs/hooks/useAsyncMount/useAsyncMount.js +1 -1
- package/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
- package/hooks/useAsyncMount/useAsyncMount.js +1 -1
- package/package.json +1 -1
- package/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
- package/HOCs/withTableContext/withTableContext.test.js +0 -41
- package/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
- package/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -98
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -99
- package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
- package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -65
- package/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -306
- package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -134
- package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -99
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -36
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -161
- package/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
- package/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -76
- package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -104
- package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -114
- package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -177
- package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
- package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -52
- package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
- package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -37
- package/cjs/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
- package/cjs/HOCs/withTableContext/withTableContext.test.js +0 -46
- package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
- package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -103
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -104
- package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -70
- package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -311
- package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -139
- package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -104
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -41
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -166
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -81
- package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -109
- package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -119
- package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -182
- package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
- package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -57
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -42
|
@@ -9,14 +9,57 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import React, { createRef } from 'react';
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
|
+
import { DataTypes, getDependentLookups } from '@reltio/mdm-sdk';
|
|
18
52
|
import { InlineSimpleAttributeEditor } from './InlineSimpleAttributeEditor';
|
|
53
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
54
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
55
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getDependentLookups: jest.fn(function () { return Promise.resolve(); }) })); });
|
|
56
|
+
var dependentLookups = {
|
|
57
|
+
codeValues: {
|
|
58
|
+
COUNTRY_CD: { IT: { displayName: 'Italy' }, BE: { displayName: 'Belgium' } }
|
|
59
|
+
}
|
|
60
|
+
};
|
|
19
61
|
describe('InlineSimpleAttributeEditor', function () {
|
|
62
|
+
var containerRef = createRef();
|
|
20
63
|
var attributeType = {
|
|
21
64
|
uri: 'configuration/entityTypes/HCP/attributes/Simple',
|
|
22
65
|
type: 'String',
|
|
@@ -30,9 +73,7 @@ describe('InlineSimpleAttributeEditor', function () {
|
|
|
30
73
|
ov: true
|
|
31
74
|
};
|
|
32
75
|
var defaultProps = {
|
|
33
|
-
containerRef:
|
|
34
|
-
current: null
|
|
35
|
-
},
|
|
76
|
+
containerRef: containerRef,
|
|
36
77
|
attributeType: attributeType,
|
|
37
78
|
attributeValue: attributeValue,
|
|
38
79
|
color: 'red',
|
|
@@ -42,204 +83,254 @@ describe('InlineSimpleAttributeEditor', function () {
|
|
|
42
83
|
afterEach(function () {
|
|
43
84
|
jest.clearAllMocks();
|
|
44
85
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
uri: 'configuration/entityTypes/HCP/attributes/Simple'
|
|
52
|
-
});
|
|
53
|
-
expect(dataTypeValueEditor.prop('fieldName')).toEqual('attributes.Simple');
|
|
54
|
-
expect(dataTypeValueEditor.prop('value')).toEqual('123');
|
|
55
|
-
expect(dataTypeValueEditor.prop('TextFieldProps')).toMatchObject({ fullWidth: true, autoFocus: true });
|
|
56
|
-
expect(component.find(Popover).prop('classes').paper).toBe('paper');
|
|
57
|
-
});
|
|
58
|
-
it('should change editorValue and save it on enter', function () {
|
|
59
|
-
var component = shallow(React.createElement(InlineSimpleAttributeEditor, __assign({}, defaultProps)));
|
|
60
|
-
var dataTypeValueEditor = component.find(DataTypeValueEditor);
|
|
61
|
-
expect(dataTypeValueEditor.prop('value')).toEqual('123');
|
|
62
|
-
act(function () {
|
|
63
|
-
dataTypeValueEditor.prop('onChange')('456');
|
|
64
|
-
});
|
|
65
|
-
expect(component.find(DataTypeValueEditor).prop('value')).toEqual('456');
|
|
66
|
-
act(function () {
|
|
67
|
-
component.find(Popover).simulate('keyup', { key: 'Enter' });
|
|
68
|
-
});
|
|
69
|
-
expect(defaultProps.onEdit).toHaveBeenCalledWith(__assign(__assign({}, attributeValue), { value: '456' }));
|
|
70
|
-
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
71
|
-
});
|
|
72
|
-
it('should call onEdit with proper arguments for lookup value', function () {
|
|
73
|
-
var lookupAttributeValue = {
|
|
74
|
-
uri: 'entities/1/attributes/CountryCode/1',
|
|
75
|
-
value: 'Italy',
|
|
76
|
-
lookupCode: 'IT'
|
|
77
|
-
};
|
|
78
|
-
var lookupAttributeType = {
|
|
79
|
-
label: 'Country Code',
|
|
80
|
-
name: 'CountryCode',
|
|
81
|
-
type: 'String',
|
|
82
|
-
uri: 'configuration/entityTypes/HCP/attributes/CountryCode',
|
|
83
|
-
dependentLookupCode: 'COUNTRY_CD'
|
|
84
|
-
};
|
|
85
|
-
var props = __assign(__assign({}, defaultProps), { attributeType: lookupAttributeType, attributeValue: lookupAttributeValue });
|
|
86
|
-
var component = shallow(React.createElement(InlineSimpleAttributeEditor, __assign({}, props)));
|
|
87
|
-
var dataTypeValueEditor = component.find(DataTypeValueEditor);
|
|
88
|
-
expect(dataTypeValueEditor.prop('value')).toEqual({ lookupCode: 'IT', value: 'Italy' });
|
|
89
|
-
act(function () {
|
|
90
|
-
dataTypeValueEditor.prop('onChange')({ lookupCode: 'BE', value: 'Belgium' });
|
|
91
|
-
});
|
|
92
|
-
expect(component.find(DataTypeValueEditor).prop('value')).toEqual({ lookupCode: 'BE', value: 'Belgium' });
|
|
93
|
-
act(function () {
|
|
94
|
-
component.find(Popover).simulate('keyup', { key: 'Enter' });
|
|
95
|
-
});
|
|
96
|
-
expect(defaultProps.onEdit).toHaveBeenCalledWith({
|
|
97
|
-
uri: lookupAttributeValue.uri,
|
|
98
|
-
lookupCode: 'BE',
|
|
99
|
-
value: 'Belgium'
|
|
100
|
-
});
|
|
101
|
-
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
102
|
-
});
|
|
103
|
-
it('should call onEdit with proper arguments for numeric empty value', function () {
|
|
104
|
-
var numericAttributeValue = {
|
|
105
|
-
uri: 'entities/1/attributes/Int/1',
|
|
106
|
-
value: '11'
|
|
107
|
-
};
|
|
108
|
-
var numericAttributeType = {
|
|
109
|
-
label: 'Int',
|
|
110
|
-
name: 'Int',
|
|
111
|
-
type: 'Int',
|
|
112
|
-
uri: 'configuration/entityTypes/Product/attributes/Int'
|
|
86
|
+
var setUp = function (props) {
|
|
87
|
+
if (props === void 0) { props = {}; }
|
|
88
|
+
var user = userEvent.setup();
|
|
89
|
+
var Providers = function (_a) {
|
|
90
|
+
var children = _a.children;
|
|
91
|
+
return (React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment }, children));
|
|
113
92
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
expect(component.find(DataTypeValueEditor).prop('value')).toBe('');
|
|
122
|
-
act(function () {
|
|
123
|
-
component.find(Popover).simulate('keyup', { key: 'Enter' });
|
|
124
|
-
});
|
|
125
|
-
expect(defaultProps.onEdit).toHaveBeenCalledWith({ uri: numericAttributeValue.uri, value: null });
|
|
126
|
-
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
93
|
+
return __assign({ user: user }, render(React.createElement(InlineSimpleAttributeEditor, __assign({}, defaultProps, props)), { wrapper: Providers }));
|
|
94
|
+
};
|
|
95
|
+
it('should render component correctly', function () {
|
|
96
|
+
setUp();
|
|
97
|
+
expect(screen.getByTestId('inline-simple-attribute-editor')).toBeInTheDocument();
|
|
98
|
+
expect(screen.getByRole('textbox')).toHaveValue('123');
|
|
127
99
|
});
|
|
128
|
-
it('should
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
100
|
+
it('should change editorValue and save it on enter', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
+
var user;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
user = setUp().user;
|
|
106
|
+
return [4 /*yield*/, user.type(screen.getByRole('textbox'), '456')];
|
|
107
|
+
case 1:
|
|
108
|
+
_a.sent();
|
|
109
|
+
expect(screen.getByRole('textbox')).toHaveValue('123456');
|
|
110
|
+
return [4 /*yield*/, user.keyboard('{enter}')];
|
|
111
|
+
case 2:
|
|
112
|
+
_a.sent();
|
|
113
|
+
expect(defaultProps.onEdit).toHaveBeenCalledWith(__assign(__assign({}, attributeValue), { value: '123456' }));
|
|
114
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
115
|
+
return [2 /*return*/];
|
|
116
|
+
}
|
|
134
117
|
});
|
|
135
|
-
|
|
136
|
-
|
|
118
|
+
}); });
|
|
119
|
+
it('should call onEdit with proper arguments for lookup value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
120
|
+
var lookupAttributeValue, lookupAttributeType, user, backdrop, comboBox;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
getDependentLookups.mockResolvedValueOnce(dependentLookups);
|
|
125
|
+
lookupAttributeValue = {
|
|
126
|
+
uri: 'entities/1/attributes/CountryCode/1',
|
|
127
|
+
value: 'Italy',
|
|
128
|
+
lookupCode: 'IT'
|
|
129
|
+
};
|
|
130
|
+
lookupAttributeType = {
|
|
131
|
+
label: 'Country Code',
|
|
132
|
+
name: 'CountryCode',
|
|
133
|
+
type: 'String',
|
|
134
|
+
uri: 'configuration/entityTypes/HCP/attributes/CountryCode',
|
|
135
|
+
dependentLookupCode: 'COUNTRY_CD'
|
|
136
|
+
};
|
|
137
|
+
user = setUp({ attributeType: lookupAttributeType, attributeValue: lookupAttributeValue }).user;
|
|
138
|
+
backdrop = screen.getByRole('presentation').firstChild;
|
|
139
|
+
comboBox = screen.getByRole('combobox');
|
|
140
|
+
return [4 /*yield*/, user.click(comboBox)];
|
|
141
|
+
case 1:
|
|
142
|
+
_a.sent();
|
|
143
|
+
return [4 /*yield*/, user.click(screen.getByText('Belgium (BE)'))];
|
|
144
|
+
case 2:
|
|
145
|
+
_a.sent();
|
|
146
|
+
expect(comboBox).toHaveValue('Belgium (BE)');
|
|
147
|
+
return [4 /*yield*/, user.click(backdrop)];
|
|
148
|
+
case 3:
|
|
149
|
+
_a.sent();
|
|
150
|
+
expect(defaultProps.onEdit).toHaveBeenCalledWith({
|
|
151
|
+
uri: lookupAttributeValue.uri,
|
|
152
|
+
lookupCode: 'BE',
|
|
153
|
+
value: 'Belgium'
|
|
154
|
+
});
|
|
155
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
156
|
+
return [2 /*return*/];
|
|
157
|
+
}
|
|
137
158
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
}); });
|
|
160
|
+
it('should call onEdit with proper arguments for numeric empty value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
161
|
+
var numericAttributeValue, numericAttributeType, user, input;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0:
|
|
165
|
+
numericAttributeValue = {
|
|
166
|
+
uri: 'entities/1/attributes/Int/1',
|
|
167
|
+
value: '11'
|
|
168
|
+
};
|
|
169
|
+
numericAttributeType = {
|
|
170
|
+
label: 'Int',
|
|
171
|
+
name: 'Int',
|
|
172
|
+
type: 'Int',
|
|
173
|
+
uri: 'configuration/entityTypes/Product/attributes/Int'
|
|
174
|
+
};
|
|
175
|
+
user = setUp({ attributeType: numericAttributeType, attributeValue: numericAttributeValue }).user;
|
|
176
|
+
input = screen.getByRole('textbox');
|
|
177
|
+
return [4 /*yield*/, user.clear(input)];
|
|
178
|
+
case 1:
|
|
179
|
+
_a.sent();
|
|
180
|
+
expect(input).toHaveValue('');
|
|
181
|
+
return [4 /*yield*/, user.keyboard('{enter}')];
|
|
182
|
+
case 2:
|
|
183
|
+
_a.sent();
|
|
184
|
+
expect(defaultProps.onEdit).toHaveBeenCalledWith({ uri: numericAttributeValue.uri, value: null });
|
|
185
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
186
|
+
return [2 /*return*/];
|
|
187
|
+
}
|
|
160
188
|
});
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
189
|
+
}); });
|
|
190
|
+
it('should not call props.onEdit if value is the same', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
191
|
+
var user;
|
|
192
|
+
return __generator(this, function (_a) {
|
|
193
|
+
switch (_a.label) {
|
|
194
|
+
case 0:
|
|
195
|
+
user = setUp().user;
|
|
196
|
+
return [4 /*yield*/, user.keyboard('{enter}')];
|
|
197
|
+
case 1:
|
|
198
|
+
_a.sent();
|
|
199
|
+
expect(defaultProps.onEdit).not.toHaveBeenCalled();
|
|
200
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
201
|
+
return [2 /*return*/];
|
|
202
|
+
}
|
|
164
203
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
204
|
+
}); });
|
|
205
|
+
it('should not call props.onEdit if lookup value is empty', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
206
|
+
var lookupAttributeType, user, backdrop, comboBox;
|
|
207
|
+
return __generator(this, function (_a) {
|
|
208
|
+
switch (_a.label) {
|
|
209
|
+
case 0:
|
|
210
|
+
getDependentLookups.mockResolvedValueOnce(dependentLookups);
|
|
211
|
+
lookupAttributeType = {
|
|
212
|
+
label: 'Country Code',
|
|
213
|
+
name: 'CountryCode',
|
|
214
|
+
type: 'String',
|
|
215
|
+
uri: 'configuration/entityTypes/HCP/attributes/CountryCode',
|
|
216
|
+
dependentLookupCode: 'COUNTRY_CD'
|
|
217
|
+
};
|
|
218
|
+
user = setUp({ attributeType: lookupAttributeType, attributeValue: null }).user;
|
|
219
|
+
backdrop = screen.getByRole('presentation').firstChild;
|
|
220
|
+
comboBox = screen.getByRole('combobox');
|
|
221
|
+
expect(comboBox).toHaveValue('');
|
|
222
|
+
return [4 /*yield*/, user.click(backdrop)];
|
|
223
|
+
case 1:
|
|
224
|
+
_a.sent();
|
|
225
|
+
expect(defaultProps.onEdit).not.toHaveBeenCalled();
|
|
226
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
227
|
+
return [2 /*return*/];
|
|
228
|
+
}
|
|
174
229
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
230
|
+
}); });
|
|
231
|
+
it('should change editorValue and cancel it on esc', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
232
|
+
var user, textBox;
|
|
233
|
+
return __generator(this, function (_a) {
|
|
234
|
+
switch (_a.label) {
|
|
235
|
+
case 0:
|
|
236
|
+
user = setUp().user;
|
|
237
|
+
textBox = screen.getByRole('textbox');
|
|
238
|
+
return [4 /*yield*/, user.type(textBox, '456')];
|
|
239
|
+
case 1:
|
|
240
|
+
_a.sent();
|
|
241
|
+
expect(textBox).toHaveValue('123456');
|
|
242
|
+
return [4 /*yield*/, user.keyboard('{Escape}')];
|
|
243
|
+
case 2:
|
|
244
|
+
_a.sent();
|
|
245
|
+
expect(defaultProps.onEdit).not.toHaveBeenCalled();
|
|
246
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
247
|
+
return [2 /*return*/];
|
|
248
|
+
}
|
|
178
249
|
});
|
|
179
|
-
|
|
180
|
-
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
181
|
-
});
|
|
250
|
+
}); });
|
|
182
251
|
it('should provide correct class to popover, if attribute type is boolean', function () {
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
expect(
|
|
252
|
+
setUp({ attributeType: __assign(__assign({}, attributeType), { type: DataTypes.TYPE_BOOLEAN }) });
|
|
253
|
+
var editor = screen.getByTestId('inline-simple-attribute-editor');
|
|
254
|
+
expect(editor.querySelector('.paper')).toHaveClass('booleanEditor');
|
|
186
255
|
});
|
|
187
256
|
it('should provide correct class to popover, if attribute type is timestamp', function () {
|
|
188
|
-
|
|
189
|
-
var
|
|
190
|
-
expect(
|
|
257
|
+
setUp({ attributeType: __assign(__assign({}, attributeType), { type: DataTypes.TYPE_TIMESTAMP }) });
|
|
258
|
+
var editor = screen.getByTestId('inline-simple-attribute-editor');
|
|
259
|
+
expect(editor.querySelector('.paper')).toHaveClass('timestampEditor');
|
|
191
260
|
});
|
|
192
|
-
it('should not call props.onEdit and props.onClose on enter if data type is DataTypes.TYPE_BLOB', function () {
|
|
193
|
-
var blobAttributeValue
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
name: 'Text',
|
|
219
|
-
type: 'Text',
|
|
220
|
-
uri: 'configuration/entityTypes/Product/attributes/Text'
|
|
221
|
-
};
|
|
222
|
-
var props = __assign(__assign({}, defaultProps), { attributeType: textAttributeType, attributeValue: textAttributeValue });
|
|
223
|
-
var component = shallow(React.createElement(InlineSimpleAttributeEditor, __assign({}, props)));
|
|
224
|
-
act(function () {
|
|
225
|
-
component.find(Popover).simulate('keyup', { key: 'Enter' });
|
|
261
|
+
it('should not call props.onEdit and props.onClose on enter if data type is DataTypes.TYPE_BLOB', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
262
|
+
var blobAttributeValue, blobAttributeType, user;
|
|
263
|
+
return __generator(this, function (_a) {
|
|
264
|
+
switch (_a.label) {
|
|
265
|
+
case 0:
|
|
266
|
+
blobAttributeValue = {
|
|
267
|
+
uri: 'entities/1/attributes/Blob/484Uit5c0',
|
|
268
|
+
value: 'text\ntext'
|
|
269
|
+
};
|
|
270
|
+
blobAttributeType = {
|
|
271
|
+
label: 'Blob',
|
|
272
|
+
name: 'Blob',
|
|
273
|
+
type: 'Blob',
|
|
274
|
+
uri: 'configuration/entityTypes/Product/attributes/Blob'
|
|
275
|
+
};
|
|
276
|
+
user = setUp({ attributeType: blobAttributeType, attributeValue: blobAttributeValue }).user;
|
|
277
|
+
return [4 /*yield*/, user.click(screen.getByRole('textbox'))];
|
|
278
|
+
case 1:
|
|
279
|
+
_a.sent();
|
|
280
|
+
return [4 /*yield*/, user.keyboard('{Enter}')];
|
|
281
|
+
case 2:
|
|
282
|
+
_a.sent();
|
|
283
|
+
expect(defaultProps.onEdit).not.toHaveBeenCalled();
|
|
284
|
+
expect(defaultProps.onClose).not.toHaveBeenCalled();
|
|
285
|
+
return [2 /*return*/];
|
|
286
|
+
}
|
|
226
287
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
288
|
+
}); });
|
|
289
|
+
it('should not call props.onEdit and props.onClose on enter if data type is DataTypes.TYPE_TEXT', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
290
|
+
var textAttributeValue, textAttributeType, user;
|
|
291
|
+
return __generator(this, function (_a) {
|
|
292
|
+
switch (_a.label) {
|
|
293
|
+
case 0:
|
|
294
|
+
textAttributeValue = {
|
|
295
|
+
uri: 'entities/1/attributes/Text/484Uit5c0',
|
|
296
|
+
value: 'text\ntext'
|
|
297
|
+
};
|
|
298
|
+
textAttributeType = {
|
|
299
|
+
label: 'Text',
|
|
300
|
+
name: 'Text',
|
|
301
|
+
type: 'Text',
|
|
302
|
+
uri: 'configuration/entityTypes/Product/attributes/Text'
|
|
303
|
+
};
|
|
304
|
+
user = setUp({ attributeType: textAttributeType, attributeValue: textAttributeValue }).user;
|
|
305
|
+
return [4 /*yield*/, user.click(screen.getByRole('textbox'))];
|
|
306
|
+
case 1:
|
|
307
|
+
_a.sent();
|
|
308
|
+
return [4 /*yield*/, user.keyboard('{Enter}')];
|
|
309
|
+
case 2:
|
|
310
|
+
_a.sent();
|
|
311
|
+
expect(defaultProps.onEdit).not.toHaveBeenCalled();
|
|
312
|
+
expect(defaultProps.onClose).not.toHaveBeenCalled();
|
|
313
|
+
return [2 /*return*/];
|
|
314
|
+
}
|
|
235
315
|
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
|
|
240
|
-
|
|
316
|
+
}); });
|
|
317
|
+
it('should call props.onEdit and props.onClose on backdrop click if new value is set', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
318
|
+
var user, backdrop;
|
|
319
|
+
return __generator(this, function (_a) {
|
|
320
|
+
switch (_a.label) {
|
|
321
|
+
case 0:
|
|
322
|
+
user = setUp().user;
|
|
323
|
+
return [4 /*yield*/, user.type(screen.getByRole('textbox'), '456')];
|
|
324
|
+
case 1:
|
|
325
|
+
_a.sent();
|
|
326
|
+
backdrop = screen.getByRole('presentation').firstChild;
|
|
327
|
+
return [4 /*yield*/, user.click(backdrop)];
|
|
328
|
+
case 2:
|
|
329
|
+
_a.sent();
|
|
330
|
+
expect(defaultProps.onEdit).toHaveBeenCalledWith(__assign(__assign({}, attributeValue), { value: '123456' }));
|
|
331
|
+
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
332
|
+
return [2 /*return*/];
|
|
333
|
+
}
|
|
241
334
|
});
|
|
242
|
-
|
|
243
|
-
expect(defaultProps.onClose).toHaveBeenCalled();
|
|
244
|
-
});
|
|
335
|
+
}); });
|
|
245
336
|
});
|
|
@@ -1,24 +1,54 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
13
|
+
import { render, screen } from '@testing-library/react';
|
|
14
|
+
import userEvent from '@testing-library/user-event';
|
|
15
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
4
16
|
import { InternalLink } from './InternalLink';
|
|
5
17
|
describe('InternalLink tests', function () {
|
|
18
|
+
var setUp = function (props) {
|
|
19
|
+
if (props === void 0) { props = {}; }
|
|
20
|
+
var user = userEvent.setup();
|
|
21
|
+
var Providers = function (_a) {
|
|
22
|
+
var children = _a.children;
|
|
23
|
+
return React.createElement(BrowserRouter, null, children);
|
|
24
|
+
};
|
|
25
|
+
return __assign({ user: user }, render(React.createElement(InternalLink, __assign({}, props)), { wrapper: Providers }));
|
|
26
|
+
};
|
|
6
27
|
it('should render router link in router context', function () {
|
|
7
28
|
window.location.assign('https://tst-01.reltio.com/nui/uitest1');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
expect(
|
|
29
|
+
setUp({ href: 'https://tst-01.reltio.com/nui/uitest1/search' });
|
|
30
|
+
var link = screen.getByRole('link');
|
|
31
|
+
expect(link).toHaveAttribute('href', '/nui/uitest1/search');
|
|
11
32
|
});
|
|
12
33
|
it('should render html link outside router context', function () {
|
|
13
34
|
window.location.assign('https://tst-01.reltio.com/ui/uitest1');
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
render(React.createElement(InternalLink, { href: 'https://tst-01.reltio.com/ui/uitest1/search' }));
|
|
36
|
+
var link = screen.getByRole('link');
|
|
37
|
+
expect(link).toHaveAttribute('href', 'https://tst-01.reltio.com/ui/uitest1/search');
|
|
16
38
|
});
|
|
17
39
|
it('should not render Link if href is undefined', function () {
|
|
18
40
|
window.location.assign('https://tst-01.reltio.com/nui/uitest1');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
41
|
+
setUp();
|
|
42
|
+
expect(screen.queryByRole('link')).not.toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
it('should apply custom class name', function () {
|
|
45
|
+
setUp({ href: 'https://tst-01.reltio.com/nui/uitest1/search', className: 'custom-class' });
|
|
46
|
+
var link = screen.getByRole('link');
|
|
47
|
+
expect(link).toHaveClass('custom-class');
|
|
48
|
+
});
|
|
49
|
+
it('should pass other props to the link', function () {
|
|
50
|
+
setUp({ href: 'https://tst-01.reltio.com/nui/uitest1/search', 'data-reltio-id': 'internal-link' });
|
|
51
|
+
var link = screen.getByTestId('internal-link');
|
|
52
|
+
expect(link).toBeInTheDocument();
|
|
23
53
|
});
|
|
24
54
|
});
|