@reltio/components 1.4.2051 → 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/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- 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/cjs/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/cjs/ChartTooltip/ChartTooltip.js +3 -3
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- 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/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
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var enzyme_1 = require("enzyme");
|
|
19
|
-
var moment_1 = __importDefault(require("moment"));
|
|
20
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
21
|
-
var MetaInfoItem_1 = require("../MetaInfoItem");
|
|
22
|
-
var ReadOnlyAttributesPager_1 = require("../../../ReadOnlyAttributesPager");
|
|
23
|
-
var attributes_test_data_1 = require("../../attributes.test-data");
|
|
24
|
-
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
25
|
-
var MetaInfoList_1 = require("./MetaInfoList");
|
|
26
|
-
jest.mock('../../../ReadOnlyAttributesPager', function () { return ({
|
|
27
|
-
ReadOnlyAttributesPager: function () { return null; }
|
|
28
|
-
}); });
|
|
29
|
-
var defaultProps = {
|
|
30
|
-
attributeType: attributes_test_data_1.attributeType,
|
|
31
|
-
attributeValue: attributes_test_data_1.attributeValue,
|
|
32
|
-
imageAttributeFieldsOrder: {}
|
|
33
|
-
};
|
|
34
|
-
var setUp = function (_a) {
|
|
35
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mode, mode = _d === void 0 ? mdm_sdk_1.Mode.Editing : _d;
|
|
36
|
-
return (0, enzyme_1.mount)(react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: { mode: mode } },
|
|
37
|
-
react_1.default.createElement(MetaInfoList_1.MetaInfoList, __assign({}, props))));
|
|
38
|
-
};
|
|
39
|
-
describe('MetaInfoList tests', function () {
|
|
40
|
-
it('should render system attributes correctly', function () {
|
|
41
|
-
var component = setUp({ mode: mdm_sdk_1.Mode.Viewing });
|
|
42
|
-
var currentTime = (0, moment_1.default)('2021-07-09T06:42:27.103+0000').format('HH:mm:ss');
|
|
43
|
-
expect(component.find('[title="Mime Type"]').props()).toMatchObject({
|
|
44
|
-
content: 'image/jpeg',
|
|
45
|
-
isLink: false
|
|
46
|
-
});
|
|
47
|
-
expect(component.find('[title="Creation Date"]').props()).toMatchObject({
|
|
48
|
-
content: '07-09-2021',
|
|
49
|
-
isLink: false
|
|
50
|
-
});
|
|
51
|
-
expect(component.find('[title="Creation Time"]').props()).toMatchObject({
|
|
52
|
-
content: currentTime,
|
|
53
|
-
isLink: false
|
|
54
|
-
});
|
|
55
|
-
expect(component.find('[title="Dimensions"]').props()).toMatchObject({
|
|
56
|
-
content: '1034 x 1933 pixels',
|
|
57
|
-
isLink: false
|
|
58
|
-
});
|
|
59
|
-
expect(component.find('[title="Size"]').props()).toMatchObject({
|
|
60
|
-
content: '637.21 KB',
|
|
61
|
-
isLink: false
|
|
62
|
-
});
|
|
63
|
-
expect(component.find('[title="Full image URL (S3)"]').props()).toMatchObject({
|
|
64
|
-
content: 'https://vk.com',
|
|
65
|
-
isLink: true
|
|
66
|
-
});
|
|
67
|
-
expect(component.find('[title="Preview image URL (S3)"]').props()).toMatchObject({
|
|
68
|
-
content: 'https://github.com',
|
|
69
|
-
isLink: true
|
|
70
|
-
});
|
|
71
|
-
expect(component.find('[title="Small image URL (S3)"]').props()).toMatchObject({
|
|
72
|
-
content: 'https://bitbucket.com',
|
|
73
|
-
isLink: true
|
|
74
|
-
});
|
|
75
|
-
expect(component.find('[title="Full image URL (CDN)"]').props()).toMatchObject({
|
|
76
|
-
content: 'https://google.com',
|
|
77
|
-
isLink: true
|
|
78
|
-
});
|
|
79
|
-
expect(component.find('[title="Preview image URL (CDN)"]').props()).toMatchObject({
|
|
80
|
-
content: 'https://twitter.com',
|
|
81
|
-
isLink: true
|
|
82
|
-
});
|
|
83
|
-
expect(component.find('[title="Small image URL (CDN)"]').props()).toMatchObject({
|
|
84
|
-
content: 'https://facebook.com',
|
|
85
|
-
isLink: true
|
|
86
|
-
});
|
|
87
|
-
expect(component.find(MetaInfoItem_1.MetaInfoItem)).toHaveLength(11);
|
|
88
|
-
});
|
|
89
|
-
it('should render MetaInfoItems with correct content and empty params', function () {
|
|
90
|
-
var value = {
|
|
91
|
-
value: {
|
|
92
|
-
CdnUrl: [],
|
|
93
|
-
CdnUrlPreview: [],
|
|
94
|
-
CdnUrlThumbnail: [],
|
|
95
|
-
CreationTimestamp: [],
|
|
96
|
-
Height: [],
|
|
97
|
-
MimeType: [],
|
|
98
|
-
Size: [],
|
|
99
|
-
Url: [],
|
|
100
|
-
UrlPreview: [],
|
|
101
|
-
UrlThumbnail: [],
|
|
102
|
-
Width: []
|
|
103
|
-
},
|
|
104
|
-
uri: '123'
|
|
105
|
-
};
|
|
106
|
-
var component = setUp({ props: __assign(__assign({}, defaultProps), { attributeValue: value }) });
|
|
107
|
-
expect(component.find(MetaInfoItem_1.MetaInfoItem).length).toBe(0);
|
|
108
|
-
});
|
|
109
|
-
it('should render MetaInfoItems with correct content with empty value', function () {
|
|
110
|
-
var value = { uri: '123', value: {} };
|
|
111
|
-
var component = setUp({ props: __assign(__assign({}, defaultProps), { attributeValue: value }) });
|
|
112
|
-
expect(component.find(MetaInfoItem_1.MetaInfoItem).length).toBe(0);
|
|
113
|
-
});
|
|
114
|
-
it('should not render not system attributes if mode is "Editing"', function () {
|
|
115
|
-
var component = setUp({ mode: mdm_sdk_1.Mode.Editing });
|
|
116
|
-
expect(component.find(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager)).toHaveLength(0);
|
|
117
|
-
});
|
|
118
|
-
it('should not render not system attributes if mode is "Suggesting"', function () {
|
|
119
|
-
var component = setUp({ mode: mdm_sdk_1.Mode.Suggesting });
|
|
120
|
-
expect(component.find(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager)).toHaveLength(0);
|
|
121
|
-
});
|
|
122
|
-
it('should render not system attributes correctly if mode is "Viewing"', function () {
|
|
123
|
-
var component = setUp({ mode: mdm_sdk_1.Mode.Viewing });
|
|
124
|
-
expect(component.find(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager).at(0).props()).toMatchObject({
|
|
125
|
-
attributeType: {
|
|
126
|
-
label: 'String',
|
|
127
|
-
name: 'String',
|
|
128
|
-
type: 'String',
|
|
129
|
-
system: false,
|
|
130
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String'
|
|
131
|
-
},
|
|
132
|
-
values: [
|
|
133
|
-
{
|
|
134
|
-
type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String',
|
|
135
|
-
ov: true,
|
|
136
|
-
value: 'rere',
|
|
137
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String/3aL9d8oMS'
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String',
|
|
141
|
-
value: '',
|
|
142
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String/uri$$1626678443648'
|
|
143
|
-
}
|
|
144
|
-
],
|
|
145
|
-
parentUri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM'
|
|
146
|
-
});
|
|
147
|
-
expect(component.find(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager).at(1).props()).toMatchObject({
|
|
148
|
-
attributeType: {
|
|
149
|
-
label: 'Date',
|
|
150
|
-
name: 'Date',
|
|
151
|
-
type: 'Date',
|
|
152
|
-
system: false,
|
|
153
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Date'
|
|
154
|
-
},
|
|
155
|
-
values: [
|
|
156
|
-
{
|
|
157
|
-
value: '2021-07-07',
|
|
158
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/Date/uri$$1626678310141',
|
|
159
|
-
type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Date'
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
parentUri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM'
|
|
163
|
-
});
|
|
164
|
-
expect(component.find(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager)).toHaveLength(2);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var enzyme_1 = require("enzyme");
|
|
19
|
-
var Image_1 = require("../../../Image");
|
|
20
|
-
var constants_1 = require("./constants");
|
|
21
|
-
var Thumbnails_1 = require("./Thumbnails");
|
|
22
|
-
describe('Thumbnails tests', function () {
|
|
23
|
-
it('should render 10 images', function () {
|
|
24
|
-
var attributeValues = [];
|
|
25
|
-
for (var i = 0; i <= 9; i++) {
|
|
26
|
-
attributeValues.push({ uri: "".concat(i), value: { UrlThumbnail: [{ uri: "0".concat(i), value: "#".concat(i) }] } });
|
|
27
|
-
}
|
|
28
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(Thumbnails_1.Thumbnails, { attributeValues: attributeValues, attributeValueIndex: 0, setAttributeValueIndex: jest.fn() }));
|
|
29
|
-
expect(component.find(Image_1.Image)).toHaveLength(10);
|
|
30
|
-
});
|
|
31
|
-
it('should render 100 images', function () {
|
|
32
|
-
var attributeValues = [];
|
|
33
|
-
for (var i = 0; i <= 99; i++) {
|
|
34
|
-
attributeValues.push({ uri: "".concat(i), value: { UrlThumbnail: [{ uri: "0".concat(i), value: "#".concat(i) }] } });
|
|
35
|
-
}
|
|
36
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(Thumbnails_1.Thumbnails, { attributeValues: attributeValues, attributeValueIndex: 0, setAttributeValueIndex: jest.fn() }));
|
|
37
|
-
expect(component.find(Image_1.Image)).toHaveLength(100);
|
|
38
|
-
});
|
|
39
|
-
it('should render 0 images', function () {
|
|
40
|
-
var attributeValues = [];
|
|
41
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(Thumbnails_1.Thumbnails, { attributeValues: attributeValues, attributeValueIndex: 0, setAttributeValueIndex: jest.fn() }));
|
|
42
|
-
expect(component.find(Image_1.Image)).toHaveLength(0);
|
|
43
|
-
});
|
|
44
|
-
it('should render 100 images and navigate', function () {
|
|
45
|
-
var attributeValues = [];
|
|
46
|
-
for (var i = 0; i <= 99; i++) {
|
|
47
|
-
attributeValues.push({ uri: "".concat(i), value: { UrlThumbnail: [{ uri: "0".concat(i), value: "#".concat(i) }] } });
|
|
48
|
-
}
|
|
49
|
-
var defaultProps = { attributeValues: attributeValues, attributeValueIndex: 0, setAttributeValueIndex: jest.fn() };
|
|
50
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(Thumbnails_1.Thumbnails, __assign({}, defaultProps)));
|
|
51
|
-
expect(component.find(Image_1.Image)).toHaveLength(100);
|
|
52
|
-
var gridRef = component.find('.thumbnails').getDOMNode();
|
|
53
|
-
Object.defineProperties(gridRef, {
|
|
54
|
-
offsetWidth: {
|
|
55
|
-
get: function () { return 1200; }
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
gridRef.scroll = jest.fn();
|
|
59
|
-
gridRef.scroll.mockImplementation(function (x) {
|
|
60
|
-
gridRef.scrollLeft = x;
|
|
61
|
-
});
|
|
62
|
-
component.setProps(__assign(__assign({}, defaultProps), { attributeValueIndex: 20 }));
|
|
63
|
-
component.update();
|
|
64
|
-
expect(gridRef.scrollLeft).toBe(20 * constants_1.IMAGE_WIDTH + 20 * constants_1.IMAGE_PADDING + constants_1.CONTAINER_MARGIN);
|
|
65
|
-
component.setProps(__assign(__assign({}, defaultProps), { attributeValueIndex: 19 }));
|
|
66
|
-
component.update();
|
|
67
|
-
expect(gridRef.scrollLeft).toBe(18 * constants_1.IMAGE_WIDTH + 19 * constants_1.IMAGE_PADDING + constants_1.CONTAINER_MARGIN);
|
|
68
|
-
component.setProps(__assign(__assign({}, defaultProps), { attributeValueIndex: 18 }));
|
|
69
|
-
component.update();
|
|
70
|
-
expect(gridRef.scrollLeft).toBe(17 * constants_1.IMAGE_WIDTH + 18 * constants_1.IMAGE_PADDING + constants_1.CONTAINER_MARGIN);
|
|
71
|
-
component.setProps(__assign(__assign({}, defaultProps), { attributeValueIndex: 19 }));
|
|
72
|
-
component.update();
|
|
73
|
-
expect(gridRef.scrollLeft).toBe(17 * constants_1.IMAGE_WIDTH + 18 * constants_1.IMAGE_PADDING + constants_1.CONTAINER_MARGIN);
|
|
74
|
-
component.setProps(__assign(__assign({}, defaultProps), { attributeValueIndex: 20 }));
|
|
75
|
-
component.update();
|
|
76
|
-
expect(gridRef.scrollLeft).toBe(17 * constants_1.IMAGE_WIDTH + 18 * constants_1.IMAGE_PADDING + constants_1.CONTAINER_MARGIN);
|
|
77
|
-
component.setProps(__assign(__assign({}, defaultProps), { attributeValueIndex: 28 }));
|
|
78
|
-
component.update();
|
|
79
|
-
expect(gridRef.scrollLeft).toBe(constants_1.IMAGE_WIDTH + constants_1.IMAGE_PADDING + (17 * constants_1.IMAGE_WIDTH + 18 * constants_1.IMAGE_PADDING + constants_1.CONTAINER_MARGIN));
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
var react_1 = __importDefault(require("react"));
|
|
29
|
-
var enzyme_1 = require("enzyme");
|
|
30
|
-
var InlineImageAttributesBlock_1 = require("./InlineImageAttributesBlock");
|
|
31
|
-
var InlineImageAttribute_1 = require("../../../InlineImageAttribute");
|
|
32
|
-
describe('ImageAttributesRenderer tests', function () {
|
|
33
|
-
it('should render correctly', function () {
|
|
34
|
-
var crosswalks = [
|
|
35
|
-
{
|
|
36
|
-
uri: 'entities/j8K1vc9/crosswalks/12jf9nL05',
|
|
37
|
-
type: 'configuration/sources/Reltio',
|
|
38
|
-
value: 'nQpZyQt',
|
|
39
|
-
reltioLoadDate: '2021-06-11T08:24:31.726Z',
|
|
40
|
-
createDate: '2018-11-19T12:14:00.735Z',
|
|
41
|
-
updateDate: '2018-11-19T12:14:00.735Z',
|
|
42
|
-
attributes: ['configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail']
|
|
43
|
-
}
|
|
44
|
-
];
|
|
45
|
-
var props = {
|
|
46
|
-
attributeValues: [
|
|
47
|
-
{
|
|
48
|
-
type: 'configuration/entityTypes/Employee/attributes/ImageGallery',
|
|
49
|
-
uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv',
|
|
50
|
-
value: {
|
|
51
|
-
UrlThumbnail: [
|
|
52
|
-
{
|
|
53
|
-
type: 'configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail',
|
|
54
|
-
ov: true,
|
|
55
|
-
value: '/test123.jpg',
|
|
56
|
-
uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv/UrlThumbnail/5555'
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
ov: true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'configuration/entityTypes/Employee/attributes/ImageGallery',
|
|
64
|
-
uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/123123',
|
|
65
|
-
value: {
|
|
66
|
-
UrlThumbnail: [
|
|
67
|
-
{
|
|
68
|
-
type: 'configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail',
|
|
69
|
-
ov: true,
|
|
70
|
-
value: '/test.jpg',
|
|
71
|
-
uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/123123/UrlThumbnail/66666'
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
ov: true
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
attributeType: {
|
|
79
|
-
attributes: [
|
|
80
|
-
{
|
|
81
|
-
name: 'UrlThumbnail',
|
|
82
|
-
type: 'String',
|
|
83
|
-
uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/UrlThumbnail'
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
name: 'ImageGallery',
|
|
87
|
-
type: 'Image',
|
|
88
|
-
uri: 'configuration/entityTypes/Employee/attributes/ImageGallery'
|
|
89
|
-
},
|
|
90
|
-
crosswalksMap: {
|
|
91
|
-
'entities/1Rd2I9Mt/attributes/ImageGallery/123123': [crosswalks[0]],
|
|
92
|
-
'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv': [crosswalks[0]]
|
|
93
|
-
},
|
|
94
|
-
onPin: jest.fn(),
|
|
95
|
-
onIgnore: jest.fn(),
|
|
96
|
-
onEdit: jest.fn(),
|
|
97
|
-
onAdd: jest.fn(),
|
|
98
|
-
onDelete: jest.fn(),
|
|
99
|
-
emptyTempAttributeUris: []
|
|
100
|
-
};
|
|
101
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(InlineImageAttributesBlock_1.InlineImageAttributesBlock, __assign({}, props)));
|
|
102
|
-
var attributes = wrapper.find(InlineImageAttribute_1.InlineImageAttribute);
|
|
103
|
-
expect(attributes.length).toBe(2);
|
|
104
|
-
var attributeValues = props.attributeValues, otherProps = __rest(props, ["attributeValues"]);
|
|
105
|
-
attributes.forEach(function (value, index) {
|
|
106
|
-
expect(value.props()).toEqual(__assign({ attributeValue: attributeValues[index] }, otherProps));
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
var react_1 = __importDefault(require("react"));
|
|
29
|
-
var enzyme_1 = require("enzyme");
|
|
30
|
-
var InlineNestedAttributesBlock_1 = require("./InlineNestedAttributesBlock");
|
|
31
|
-
var Button_1 = __importDefault(require("@mui/material/Button"));
|
|
32
|
-
describe('InlineNestedAttributesBlock tests', function () {
|
|
33
|
-
var attributeType = {
|
|
34
|
-
uri: 'configuration/entityTypes/HCP/attributes/Nested',
|
|
35
|
-
type: 'Nested',
|
|
36
|
-
name: 'Nested',
|
|
37
|
-
label: 'Nested label',
|
|
38
|
-
attributes: [
|
|
39
|
-
{
|
|
40
|
-
uri: 'configuration/entityTypes/HCP/attributes/Nested/attributes/SubNested',
|
|
41
|
-
type: 'String',
|
|
42
|
-
name: 'SubNested',
|
|
43
|
-
label: 'SubNested label'
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
};
|
|
47
|
-
var attributeValues = [
|
|
48
|
-
{
|
|
49
|
-
type: attributeType.uri,
|
|
50
|
-
uri: 'entities/sIeHttl/attributes/Nested/u123',
|
|
51
|
-
value: {
|
|
52
|
-
SubNested: [
|
|
53
|
-
{
|
|
54
|
-
uri: 'entities/sIeHttl/attributes/Nested/u123/SubNested/1',
|
|
55
|
-
value: '1'
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
ov: true
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: attributeType.uri,
|
|
63
|
-
uri: 'entities/sIeHttl/attributes/Nested/u789',
|
|
64
|
-
value: {
|
|
65
|
-
SubNested: [
|
|
66
|
-
{
|
|
67
|
-
uri: 'entities/sIeHttl/attributes/Nested/u789/SubNested/2',
|
|
68
|
-
value: '2'
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
ov: false
|
|
73
|
-
}
|
|
74
|
-
];
|
|
75
|
-
var props = {
|
|
76
|
-
attributeType: attributeType,
|
|
77
|
-
attributeValues: attributeValues,
|
|
78
|
-
parentUri: 'entities/sIeHttl',
|
|
79
|
-
crosswalksMap: {},
|
|
80
|
-
onPin: jest.fn(),
|
|
81
|
-
onIgnore: jest.fn(),
|
|
82
|
-
onEdit: jest.fn(),
|
|
83
|
-
onDelete: jest.fn(),
|
|
84
|
-
onAdd: jest.fn(),
|
|
85
|
-
emptyTempAttributeUris: []
|
|
86
|
-
};
|
|
87
|
-
it('should render nested attributes values', function () {
|
|
88
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(InlineNestedAttributesBlock_1.InlineNestedAttributesBlock, __assign({}, props)));
|
|
89
|
-
var attributes = wrapper.find('InlineNestedAttribute');
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
91
|
-
var attributeValues = props.attributeValues, parentUri = props.parentUri, other = __rest(props, ["attributeValues", "parentUri"]);
|
|
92
|
-
expect(attributes.length).toBe(attributeValues.length);
|
|
93
|
-
attributes.forEach(function (attribute, index) {
|
|
94
|
-
expect(attribute.props()).toEqual(__assign({ attributeValue: attributeValues[index] }, other));
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
it('should render create button if values are empty', function () {
|
|
98
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(InlineNestedAttributesBlock_1.InlineNestedAttributesBlock, __assign({}, props, { attributeValues: [] })));
|
|
99
|
-
expect(wrapper.find('InlineNestedAttribute').length).toBe(0);
|
|
100
|
-
expect(wrapper.find(Button_1.default).text()).toBe('Create attribute');
|
|
101
|
-
});
|
|
102
|
-
it('should not render create button if values are empty but not editable', function () {
|
|
103
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(InlineNestedAttributesBlock_1.InlineNestedAttributesBlock, __assign({}, props, { attributeValues: [], disableEdit: true })));
|
|
104
|
-
expect(wrapper.find('InlineNestedAttribute').length).toBe(0);
|
|
105
|
-
expect(wrapper.find(Button_1.default).length).toBe(0);
|
|
106
|
-
});
|
|
107
|
-
it('should call props.onAdd on create button click', function () {
|
|
108
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(InlineNestedAttributesBlock_1.InlineNestedAttributesBlock, __assign({}, props, { attributeValues: [] })));
|
|
109
|
-
wrapper
|
|
110
|
-
.find(Button_1.default)
|
|
111
|
-
.filterWhere(function (button) { return button.text() === 'Create attribute'; })
|
|
112
|
-
.simulate('click');
|
|
113
|
-
expect(props.onAdd).toHaveBeenCalledWith({
|
|
114
|
-
parentUri: props.parentUri,
|
|
115
|
-
attributeType: props.attributeType,
|
|
116
|
-
index: 0
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
var react_1 = __importDefault(require("react"));
|
|
29
|
-
var enzyme_1 = require("enzyme");
|
|
30
|
-
var InlineReferenceAttributesBlock_1 = require("./InlineReferenceAttributesBlock");
|
|
31
|
-
describe('InlineReferenceAttributesBlock tests', function () {
|
|
32
|
-
var attributeType = {
|
|
33
|
-
label: 'Address',
|
|
34
|
-
name: 'Address',
|
|
35
|
-
type: 'Reference',
|
|
36
|
-
uri: 'configuration/entityTypes/HCP/attributes/Address',
|
|
37
|
-
referencedAttributeURIs: ['configuration/entityTypes/Location/attributes/AddressLine1'],
|
|
38
|
-
relationshipTypeURI: 'configuration/relationTypes/HasAddress'
|
|
39
|
-
};
|
|
40
|
-
var attributeValues = [
|
|
41
|
-
{
|
|
42
|
-
label: 'Granada Aveue Santa Clara 1',
|
|
43
|
-
relationshipLabel: 'Office',
|
|
44
|
-
value: {
|
|
45
|
-
AddressLine1: [
|
|
46
|
-
{
|
|
47
|
-
type: 'configuration/entityTypes/Location/attributes/AddressLine1',
|
|
48
|
-
ov: true,
|
|
49
|
-
value: '3588 Granada Aveue',
|
|
50
|
-
uri: 'entities/1/attributes/Address/1/AddressLine1/1'
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
ov: true,
|
|
55
|
-
uri: 'entities/1/attributes/Address/1',
|
|
56
|
-
refEntity: {
|
|
57
|
-
type: 'configuration/entityTypes/Location',
|
|
58
|
-
crosswalks: [
|
|
59
|
-
{
|
|
60
|
-
uri: 'entities/1/crosswalks/1YWdmjzf.3VKnDCovj',
|
|
61
|
-
type: 'configuration/sources/HMS',
|
|
62
|
-
value: 'cww1',
|
|
63
|
-
createDate: '2020-09-02T16:19:12.943Z',
|
|
64
|
-
updateDate: '2020-09-02T16:19:12.943Z',
|
|
65
|
-
attributeURIs: [
|
|
66
|
-
'entities/1/attributes/Address/1/AddressLine1/1',
|
|
67
|
-
'entities/1/attributes/Address/1'
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
objectURI: 'entities/1'
|
|
72
|
-
},
|
|
73
|
-
refRelation: {
|
|
74
|
-
type: 'configuration/relationTypes/HasAddress',
|
|
75
|
-
crosswalks: [
|
|
76
|
-
{
|
|
77
|
-
uri: 'entities/1/crosswalks/uAGtqeB.3VKnDCtBz',
|
|
78
|
-
type: 'configuration/sources/HMS',
|
|
79
|
-
value: 'cww2',
|
|
80
|
-
createDate: '2020-09-02T16:19:12.943Z',
|
|
81
|
-
updateDate: '2020-09-02T16:19:12.943Z',
|
|
82
|
-
attributeURIs: [
|
|
83
|
-
'entities/1/attributes/Address/1/AddressLine/1',
|
|
84
|
-
'entities/1/attributes/Address/1'
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
startRefPinned: false,
|
|
89
|
-
endRefPinned: false,
|
|
90
|
-
startRefIgnored: false,
|
|
91
|
-
endRefIgnored: false,
|
|
92
|
-
objectURI: 'relations/1'
|
|
93
|
-
},
|
|
94
|
-
startObjectCrosswalks: [
|
|
95
|
-
{
|
|
96
|
-
type: 'configuration/sources/HMS',
|
|
97
|
-
value: 'cww1'
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
label: 'Granada Aveue Santa Clara 2',
|
|
103
|
-
relationshipLabel: 'Office',
|
|
104
|
-
value: {
|
|
105
|
-
AddressLine1: [
|
|
106
|
-
{
|
|
107
|
-
type: 'configuration/entityTypes/Location/attributes/AddressLine1',
|
|
108
|
-
ov: true,
|
|
109
|
-
value: '3587 Granada Aveue',
|
|
110
|
-
uri: 'entities/1/attributes/Address/2/AddressLine1/1'
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
ov: true,
|
|
115
|
-
uri: 'entities/1/attributes/Address/2',
|
|
116
|
-
refEntity: {
|
|
117
|
-
type: 'configuration/entityTypes/Location',
|
|
118
|
-
crosswalks: [
|
|
119
|
-
{
|
|
120
|
-
uri: 'entities/1/crosswalks/1YWdmsWB.3VKnDDe4p',
|
|
121
|
-
type: 'configuration/sources/HMS',
|
|
122
|
-
value: 'cwf1',
|
|
123
|
-
createDate: '2020-09-02T16:19:12.943Z',
|
|
124
|
-
updateDate: '2020-09-02T16:19:12.943Z',
|
|
125
|
-
attributeURIs: [
|
|
126
|
-
'entities/1/attributes/Address/2/AddressLine1/1',
|
|
127
|
-
'entities/1/attributes/Address/2'
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
objectURI: 'entities/1'
|
|
132
|
-
},
|
|
133
|
-
refRelation: {
|
|
134
|
-
type: 'configuration/relationTypes/HasAddress',
|
|
135
|
-
crosswalks: [
|
|
136
|
-
{
|
|
137
|
-
uri: 'entities/1/crosswalks/uAGtuuR.3VKnDDiL5',
|
|
138
|
-
type: 'configuration/sources/HMS',
|
|
139
|
-
value: 'cwf2',
|
|
140
|
-
createDate: '2020-09-02T16:19:12.943Z',
|
|
141
|
-
updateDate: '2020-09-02T16:19:12.943Z',
|
|
142
|
-
attributeURIs: [
|
|
143
|
-
'entities/1/attributes/Address/2/AddressLine1/1',
|
|
144
|
-
'entities/1/attributes/Address/2'
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
startRefPinned: false,
|
|
149
|
-
endRefPinned: false,
|
|
150
|
-
startRefIgnored: false,
|
|
151
|
-
endRefIgnored: false,
|
|
152
|
-
objectURI: 'relations/2'
|
|
153
|
-
},
|
|
154
|
-
startObjectCrosswalks: [
|
|
155
|
-
{
|
|
156
|
-
type: 'configuration/sources/HMS',
|
|
157
|
-
value: 'cfw1'
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
];
|
|
162
|
-
var props = {
|
|
163
|
-
attributeType: attributeType,
|
|
164
|
-
attributeValues: attributeValues,
|
|
165
|
-
crosswalksMap: {},
|
|
166
|
-
onPin: jest.fn(),
|
|
167
|
-
onIgnore: jest.fn(),
|
|
168
|
-
onEdit: jest.fn(),
|
|
169
|
-
onDelete: jest.fn(),
|
|
170
|
-
onAdd: jest.fn(),
|
|
171
|
-
emptyTempAttributeUris: []
|
|
172
|
-
};
|
|
173
|
-
it('should render reference attributes values', function () {
|
|
174
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(InlineReferenceAttributesBlock_1.InlineReferenceAttributesBlock, __assign({}, props)));
|
|
175
|
-
var attributes = wrapper.find('InlineReferenceAttribute');
|
|
176
|
-
var attributeValues = props.attributeValues, other = __rest(props, ["attributeValues"]);
|
|
177
|
-
expect(attributes.length).toBe(attributeValues.length);
|
|
178
|
-
attributes.forEach(function (attribute, index) {
|
|
179
|
-
expect(attribute.props()).toEqual(__assign({ attributeValue: attributeValues[index] }, other));
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
});
|