@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.
Files changed (187) hide show
  1. package/AttributeListItem/AttributeListItem.d.ts +1 -1
  2. package/ChartTooltip/ChartTooltip.js +3 -3
  3. package/ColumnsSettings/ColumnsSettings.d.ts +2 -1
  4. package/ColumnsSettings/ColumnsSettings.js +2 -2
  5. package/ColumnsSettings/ColumnsSettings.test.js +14 -0
  6. package/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
  7. package/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
  8. package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
  9. package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
  10. package/DropDownMenuButton/DropDownMenuButton.js +1 -1
  11. package/HOCs/withAsyncMount/withAsyncMount.test.js +52 -52
  12. package/IgnoreButton/IgnoreButton.spec.js +109 -20
  13. package/Image/Image.d.ts +1 -1
  14. package/Image/Image.js +8 -8
  15. package/Image/Image.test.js +46 -51
  16. package/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
  17. package/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
  18. package/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
  19. package/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
  20. package/ImageAttributesLine/ImageAttributesLine.js +1 -1
  21. package/ImageAttributesLine/ImageAttributesLine.test.js +187 -193
  22. package/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
  23. package/ImageAttributesLine/imageAttributeValues.test-data.js +22 -0
  24. package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +315 -298
  25. package/ImageDetailsView/ImageDetailsView.test.js +529 -55
  26. package/ImageDetailsView/attributes.test-data.d.ts +4 -1
  27. package/ImageDetailsView/attributes.test-data.js +98 -1
  28. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
  29. package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
  30. package/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
  31. package/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
  32. package/ImageDetailsView/helpers.test.js +4 -4
  33. package/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
  34. package/ImportButton/ImportButton.test.js +94 -24
  35. package/InlineAttributesList/InlineAttributesList.test.js +22 -62
  36. package/InlineAttributesList/attributes.test-data.d.ts +4 -2
  37. package/InlineAttributesList/attributes.test-data.js +40 -1
  38. package/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
  39. package/InlineAttributesPager/InlineAttributesPager.js +1 -4
  40. package/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
  41. package/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
  42. package/InlineComplexAttribute/InlineComplexAttribute.test.js +396 -182
  43. package/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
  44. package/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
  45. package/InlineReferenceAttribute/InlineReferenceAttribute.test.js +165 -107
  46. package/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +352 -346
  47. package/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +285 -194
  48. package/InternalLink/InternalLink.test.js +41 -11
  49. package/LookupEditor/LookupEditor.test.js +180 -44
  50. package/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
  51. package/MapChart/MapChart.js +3 -8
  52. package/MapChart/MapChart.test.js +152 -188
  53. package/MapChart/components/Legend/Legend.js +3 -3
  54. package/MaskingSwitcher/MaskingSwitcher.js +1 -1
  55. package/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
  56. package/SelectEditor/SelectEditor.d.ts +4 -10
  57. package/SelectEditor/SelectEditor.js +0 -4
  58. package/SelectEditor/SelectEditor.test.js +79 -9
  59. package/SelectionPopup/SelectionPopup.d.ts +2 -1
  60. package/SelectionPopup/SelectionPopup.js +3 -3
  61. package/SelectionPopup/SelectionPopup.spec.js +90 -30
  62. package/cjs/AttributeListItem/AttributeListItem.d.ts +1 -1
  63. package/cjs/ChartTooltip/ChartTooltip.js +3 -3
  64. package/cjs/ColumnsSettings/ColumnsSettings.d.ts +2 -1
  65. package/cjs/ColumnsSettings/ColumnsSettings.js +2 -2
  66. package/cjs/ColumnsSettings/ColumnsSettings.test.js +14 -0
  67. package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
  68. package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
  69. package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
  70. package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
  71. package/cjs/DropDownMenuButton/DropDownMenuButton.js +1 -1
  72. package/cjs/HOCs/withAsyncMount/withAsyncMount.test.js +56 -56
  73. package/cjs/IgnoreButton/IgnoreButton.spec.js +109 -20
  74. package/cjs/Image/Image.d.ts +1 -1
  75. package/cjs/Image/Image.js +8 -8
  76. package/cjs/Image/Image.test.js +46 -51
  77. package/cjs/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
  78. package/cjs/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
  79. package/cjs/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
  80. package/cjs/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
  81. package/cjs/ImageAttributesLine/ImageAttributesLine.js +1 -1
  82. package/cjs/ImageAttributesLine/ImageAttributesLine.test.js +195 -224
  83. package/cjs/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
  84. package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +23 -1
  85. package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +316 -299
  86. package/cjs/ImageDetailsView/ImageDetailsView.test.js +529 -55
  87. package/cjs/ImageDetailsView/attributes.test-data.d.ts +4 -1
  88. package/cjs/ImageDetailsView/attributes.test-data.js +99 -2
  89. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
  90. package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
  91. package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
  92. package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
  93. package/cjs/ImageDetailsView/helpers.test.js +3 -3
  94. package/cjs/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
  95. package/cjs/ImportButton/ImportButton.test.js +94 -24
  96. package/cjs/InlineAttributesList/InlineAttributesList.test.js +22 -62
  97. package/cjs/InlineAttributesList/attributes.test-data.d.ts +4 -2
  98. package/cjs/InlineAttributesList/attributes.test-data.js +41 -2
  99. package/cjs/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
  100. package/cjs/InlineAttributesPager/InlineAttributesPager.js +1 -4
  101. package/cjs/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
  102. package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
  103. package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +395 -204
  104. package/cjs/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
  105. package/cjs/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
  106. package/cjs/InlineReferenceAttribute/InlineReferenceAttribute.test.js +164 -106
  107. package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +351 -345
  108. package/cjs/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +307 -193
  109. package/cjs/InternalLink/InternalLink.test.js +40 -10
  110. package/cjs/LookupEditor/LookupEditor.test.js +178 -65
  111. package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
  112. package/cjs/MapChart/MapChart.js +3 -8
  113. package/cjs/MapChart/MapChart.test.js +152 -188
  114. package/cjs/MapChart/components/Legend/Legend.js +3 -3
  115. package/cjs/MaskingSwitcher/MaskingSwitcher.js +1 -1
  116. package/cjs/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
  117. package/cjs/SelectEditor/SelectEditor.d.ts +4 -10
  118. package/cjs/SelectEditor/SelectEditor.js +0 -4
  119. package/cjs/SelectEditor/SelectEditor.test.js +79 -9
  120. package/cjs/SelectionPopup/SelectionPopup.d.ts +2 -1
  121. package/cjs/SelectionPopup/SelectionPopup.js +3 -3
  122. package/cjs/SelectionPopup/SelectionPopup.spec.js +90 -30
  123. package/cjs/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
  124. package/cjs/hooks/useAsyncMount/useAsyncMount.js +1 -1
  125. package/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
  126. package/hooks/useAsyncMount/useAsyncMount.js +1 -1
  127. package/package.json +1 -1
  128. package/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
  129. package/HOCs/withTableContext/withTableContext.test.js +0 -41
  130. package/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
  131. package/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -98
  132. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
  133. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -99
  134. package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
  135. package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -65
  136. package/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
  137. package/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -306
  138. package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
  139. package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -134
  140. package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
  141. package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -99
  142. package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
  143. package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -36
  144. package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
  145. package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -161
  146. package/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
  147. package/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -76
  148. package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
  149. package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -104
  150. package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
  151. package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -114
  152. package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
  153. package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -177
  154. package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
  155. package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -52
  156. package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
  157. package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -37
  158. package/cjs/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
  159. package/cjs/HOCs/withTableContext/withTableContext.test.js +0 -46
  160. package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
  161. package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -103
  162. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
  163. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -104
  164. package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
  165. package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -70
  166. package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
  167. package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -311
  168. package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
  169. package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -139
  170. package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
  171. package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -104
  172. package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
  173. package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -41
  174. package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
  175. package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -166
  176. package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
  177. package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -81
  178. package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
  179. package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -109
  180. package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
  181. package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -119
  182. package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
  183. package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -182
  184. package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
  185. package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -57
  186. package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
  187. package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -42
@@ -9,65 +9,113 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
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
+ }
22
47
  };
23
48
  import React from 'react';
24
- import { ReactWrapper, shallow } from 'enzyme';
49
+ import { render, screen } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
51
+ import { DndContext } from '@dnd-kit/core';
25
52
  import { InlineImageAttribute } from './InlineImageAttribute';
26
- import { InlineComplexAttribute } from '../InlineComplexAttribute';
27
- describe('InlineImageAttribute tests', function () {
28
- var attributeType = {
29
- attributes: [
53
+ var attributeType = {
54
+ attributes: [
55
+ {
56
+ name: 'UrlThumbnail',
57
+ type: 'String',
58
+ uri: 'configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail'
59
+ }
60
+ ],
61
+ name: 'ImageGallery',
62
+ type: 'Image',
63
+ uri: 'configuration/entityTypes/Employee/attributes/ImageGallery'
64
+ };
65
+ var attributeValue = {
66
+ type: attributeType.uri,
67
+ uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv',
68
+ value: {
69
+ UrlThumbnail: [
30
70
  {
31
- name: 'UrlThumbnail',
32
- type: 'String',
33
- uri: 'configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail'
71
+ type: 'configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail',
72
+ ov: true,
73
+ value: '/test.jpg',
74
+ uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv/UrlThumbnail/39V5GWWMh'
34
75
  }
35
- ],
36
- name: 'ImageGallery',
37
- type: 'Image',
38
- uri: 'configuration/entityTypes/Employee/attributes/ImageGallery'
39
- };
40
- var attributeValue = {
41
- type: attributeType.uri,
42
- uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv',
43
- value: {
44
- UrlThumbnail: [
45
- {
46
- type: 'configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail',
47
- ov: true,
48
- value: '/test.jpg',
49
- uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv/UrlThumbnail/39V5GWWMh'
50
- }
51
- ]
52
- },
53
- ov: true
54
- };
55
- var props = {
56
- attributeType: attributeType,
57
- attributeValue: attributeValue,
58
- crosswalksMap: {},
59
- onPin: jest.fn(),
60
- onIgnore: jest.fn(),
61
- onEdit: jest.fn(),
62
- onDelete: jest.fn(),
63
- onAdd: jest.fn(),
64
- emptyTempAttributeUris: []
76
+ ]
77
+ },
78
+ ov: true
79
+ };
80
+ var defaultProps = {
81
+ attributeType: attributeType,
82
+ attributeValue: attributeValue,
83
+ crosswalksMap: {},
84
+ onPin: jest.fn(),
85
+ onIgnore: jest.fn(),
86
+ onEdit: jest.fn(),
87
+ onDelete: jest.fn(),
88
+ onAdd: jest.fn(),
89
+ emptyTempAttributeUris: []
90
+ };
91
+ var setUp = function (props) {
92
+ if (props === void 0) { props = {}; }
93
+ var user = userEvent.setup();
94
+ var Providers = function (_a) {
95
+ var children = _a.children;
96
+ return React.createElement(DndContext, null, children);
65
97
  };
66
- it('should render correctly', function () {
67
- var wrapper = shallow(React.createElement(InlineImageAttribute, __assign({}, props)));
68
- var _a = wrapper.find(InlineComplexAttribute).props(), label = _a.label, wrapperProps = __rest(_a, ["label"]);
69
- expect(wrapperProps).toEqual(__assign(__assign({}, props), { attributeTypesList: attributeType.attributes }));
70
- var labelComponent = new ReactWrapper(label);
71
- expect(labelComponent.prop('src')).toBe('/test.jpg');
72
- });
98
+ return __assign({ user: user }, render(React.createElement(InlineImageAttribute, __assign({}, defaultProps, props)), { wrapper: Providers }));
99
+ };
100
+ describe('InlineImageAttribute tests', function () {
101
+ it('should render correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
102
+ var user, expandButton;
103
+ return __generator(this, function (_a) {
104
+ switch (_a.label) {
105
+ case 0:
106
+ user = setUp().user;
107
+ expect(screen.getByRole('img')).toHaveAttribute('src', '/test.jpg');
108
+ expect(screen.queryByTestId('simple-attributes-wrapper')).not.toBeInTheDocument();
109
+ expandButton = screen.getByTestId('arrow-expand-button');
110
+ expect(expandButton).toBeInTheDocument();
111
+ expect(expandButton.querySelector('svg')).not.toHaveClass('expanded');
112
+ return [4 /*yield*/, user.click(expandButton)];
113
+ case 1:
114
+ _a.sent();
115
+ expect(screen.getByTestId('simple-attributes-wrapper')).toBeInTheDocument();
116
+ expect(expandButton.querySelector('svg')).toHaveClass('expanded');
117
+ return [2 /*return*/];
118
+ }
119
+ });
120
+ }); });
73
121
  });
@@ -9,52 +9,114 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
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
+ };
12
48
  import React from 'react';
13
- import { shallow } from 'enzyme';
49
+ import { render, screen } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
51
+ import { DndContext } from '@dnd-kit/core';
14
52
  import { InlineNestedAttribute } from './InlineNestedAttribute';
15
- import { ComplexAttributeLabel } from '../ComplexAttributeLabel';
16
- describe('InlineNestedAttribute tests', function () {
17
- var attributeType = {
18
- uri: 'configuration/entityTypes/HCP/attributes/Nested',
19
- type: 'Nested',
20
- name: 'Nested',
21
- label: 'Nested label',
22
- attributes: [
53
+ var attributeType = {
54
+ uri: 'configuration/entityTypes/HCP/attributes/Nested',
55
+ type: 'Nested',
56
+ name: 'Nested',
57
+ label: 'Nested label',
58
+ attributes: [
59
+ {
60
+ uri: 'configuration/entityTypes/HCP/attributes/Nested/attributes/SubNested',
61
+ type: 'String',
62
+ name: 'SubNested',
63
+ label: 'SubNested label'
64
+ }
65
+ ],
66
+ access: ['READ', 'UPDATE', 'DELETE']
67
+ };
68
+ var attributeValue = {
69
+ label: 'Attribute Label',
70
+ uri: 'entities/1/attributes/Nested/1',
71
+ value: {
72
+ SubNested: [
23
73
  {
24
- uri: 'configuration/entityTypes/HCP/attributes/Nested/attributes/SubNested',
25
- type: 'String',
26
- name: 'SubNested',
27
- label: 'SubNested label'
74
+ uri: 'entities/1/attributes/Nested/1/SubNested/1',
75
+ value: '1'
28
76
  }
29
- ],
30
- access: ['READ', 'UPDATE', 'DELETE']
31
- };
32
- var attributeValue = {
33
- label: '1',
34
- uri: 'entities/1/attributes/Nested/1',
35
- value: {
36
- SubNested: [
37
- {
38
- uri: 'entities/1/attributes/Nested/1/SubNested/1',
39
- value: '1'
40
- }
41
- ]
42
- },
43
- ov: true
44
- };
45
- var props = {
46
- attributeType: attributeType,
47
- attributeValue: attributeValue,
48
- crosswalksMap: {},
49
- onPin: jest.fn(),
50
- onIgnore: jest.fn(),
51
- onEdit: jest.fn(),
52
- onDelete: jest.fn(),
53
- onAdd: jest.fn(),
54
- emptyTempAttributeUris: []
77
+ ]
78
+ },
79
+ ov: true
80
+ };
81
+ var defaultProps = {
82
+ attributeType: attributeType,
83
+ attributeValue: attributeValue,
84
+ crosswalksMap: {},
85
+ onPin: jest.fn(),
86
+ onIgnore: jest.fn(),
87
+ onEdit: jest.fn(),
88
+ onDelete: jest.fn(),
89
+ onAdd: jest.fn(),
90
+ emptyTempAttributeUris: []
91
+ };
92
+ var setUp = function (props) {
93
+ if (props === void 0) { props = {}; }
94
+ var user = userEvent.setup();
95
+ var Providers = function (_a) {
96
+ var children = _a.children;
97
+ return React.createElement(DndContext, null, children);
55
98
  };
56
- it('should render correctly', function () {
57
- var wrapper = shallow(React.createElement(InlineNestedAttribute, __assign({}, props)));
58
- expect(wrapper.find('InlineComplexAttribute').props()).toEqual(__assign(__assign({}, props), { attributeTypesList: attributeType.attributes, label: React.createElement(ComplexAttributeLabel, null, attributeValue.label) }));
59
- });
99
+ return __assign({ user: user }, render(React.createElement(InlineNestedAttribute, __assign({}, defaultProps, props)), { wrapper: Providers }));
100
+ };
101
+ describe('InlineNestedAttribute tests', function () {
102
+ it('should render correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
103
+ var user, expandButton;
104
+ return __generator(this, function (_a) {
105
+ switch (_a.label) {
106
+ case 0:
107
+ user = setUp().user;
108
+ expect(screen.getByText('Attribute Label')).toBeInTheDocument();
109
+ expect(screen.queryByText('SubNested label')).not.toBeInTheDocument();
110
+ expandButton = screen.getByTestId('arrow-expand-button');
111
+ expect(expandButton).toBeInTheDocument();
112
+ expect(expandButton.querySelector('svg')).not.toHaveClass('expanded');
113
+ return [4 /*yield*/, user.click(expandButton)];
114
+ case 1:
115
+ _a.sent();
116
+ expect(screen.getByText('SubNested label')).toBeInTheDocument();
117
+ expect(expandButton.querySelector('svg')).toHaveClass('expanded');
118
+ return [2 /*return*/];
119
+ }
120
+ });
121
+ }); });
60
122
  });
@@ -9,123 +9,181 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
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
+ };
12
48
  import React from 'react';
13
- import { shallow } from 'enzyme';
49
+ import { render, screen } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
51
+ import { DndContext } from '@dnd-kit/core';
14
52
  import { InlineReferenceAttribute } from './InlineReferenceAttribute';
15
- import { ComplexAttributeLabel } from '../ComplexAttributeLabel';
16
- import { InternalLink } from '../InternalLink';
17
- import { useMdmMetadata, useMdmUiPath } from '../contexts/MdmModuleContext';
18
- jest.mock('../contexts/MdmModuleContext', function () { return (__assign(__assign({}, jest.requireActual('../contexts/MdmModuleContext')), { useMdmMetadata: jest.fn(), useMdmUiPath: jest.fn() })); });
19
- describe('InlineReferenceAttribute tests', function () {
20
- var attributeType = {
21
- label: 'Address',
22
- name: 'Address',
23
- type: 'Reference',
24
- uri: 'configuration/entityTypes/HCP/attributes/Address',
25
- referencedAttributeURIs: [
26
- 'configuration/entityTypes/Location/attributes/AddressLine1',
27
- 'configuration/relationTypes/HasAddress/attributes/Status'
28
- ],
29
- relationshipTypeURI: 'configuration/relationTypes/HasAddress'
30
- };
31
- var attributes = [
53
+ import { MdmModuleProvider } from '../contexts/MdmModuleContext';
54
+ var attributeType = {
55
+ label: 'Address',
56
+ name: 'Address',
57
+ type: 'Reference',
58
+ uri: 'configuration/entityTypes/HCP/attributes/Address',
59
+ referencedAttributeURIs: [
60
+ 'configuration/entityTypes/Location/attributes/AddressLine1',
61
+ 'configuration/relationTypes/HasAddress/attributes/Status'
62
+ ],
63
+ relationshipTypeURI: 'configuration/relationTypes/HasAddress'
64
+ };
65
+ var attributes = [
66
+ {
67
+ uri: 'configuration/relationTypes/HasAddress/attributes/Status',
68
+ type: 'String',
69
+ name: 'Status',
70
+ label: 'Customer Address Status'
71
+ }
72
+ ];
73
+ var metadata = {
74
+ entityTypes: [
32
75
  {
33
- uri: 'configuration/relationTypes/HasAddress/attributes/Status',
34
- type: 'String',
35
- name: 'Status',
36
- label: 'Customer Address Status'
76
+ uri: 'configuration/entityTypes/HCP',
77
+ label: 'HCP',
78
+ attributes: [attributeType]
37
79
  }
38
- ];
39
- var metadata = {
40
- entityTypes: [
80
+ ],
81
+ relationTypes: [
82
+ {
83
+ uri: 'configuration/relationTypes/HasAddress',
84
+ label: 'has address',
85
+ attributes: attributes
86
+ }
87
+ ]
88
+ };
89
+ var attributeValue = {
90
+ label: 'Granada Aveue Santa Clara 1',
91
+ relationshipLabel: 'Office',
92
+ value: {
93
+ Status: [
41
94
  {
42
- uri: 'configuration/entityTypes/HCP',
43
- label: 'HCP',
44
- attributes: [attributeType]
95
+ type: 'configuration/relationTypes/HasAddress/attributes/Status',
96
+ ov: true,
97
+ value: 'Some status',
98
+ uri: 'entities/1/attributes/Address/1/Status/1'
45
99
  }
46
- ],
47
- relationTypes: [
100
+ ]
101
+ },
102
+ ov: true,
103
+ uri: 'entities/1/attributes/Address/1',
104
+ refEntity: {
105
+ type: 'configuration/entityTypes/Location',
106
+ crosswalks: [
48
107
  {
49
- uri: 'configuration/relationTypes/HasAddress',
50
- label: 'has address',
51
- attributes: attributes
108
+ uri: 'entities/1/crosswalks/1YWdmjzf.3VKnDCovj',
109
+ type: 'configuration/sources/HMS',
110
+ value: 'cww1',
111
+ createDate: '2020-09-02T16:19:12.943Z',
112
+ updateDate: '2020-09-02T16:19:12.943Z',
113
+ attributeURIs: ['entities/1/attributes/Address/1/AddressLine1/1', 'entities/1/attributes/Address/1']
52
114
  }
53
- ]
54
- };
55
- var attributeValue = {
56
- label: 'Granada Aveue Santa Clara 1',
57
- relationshipLabel: 'Office',
58
- value: {
59
- Status: [
60
- {
61
- type: 'configuration/relationTypes/HasAddress/attributes/Status',
62
- ov: true,
63
- value: 'Some status',
64
- uri: 'entities/1/attributes/Address/1/Status/1'
65
- }
66
- ]
67
- },
68
- ov: true,
69
- uri: 'entities/1/attributes/Address/1',
70
- refEntity: {
71
- type: 'configuration/entityTypes/Location',
72
- crosswalks: [
73
- {
74
- uri: 'entities/1/crosswalks/1YWdmjzf.3VKnDCovj',
75
- type: 'configuration/sources/HMS',
76
- value: 'cww1',
77
- createDate: '2020-09-02T16:19:12.943Z',
78
- updateDate: '2020-09-02T16:19:12.943Z',
79
- attributeURIs: ['entities/1/attributes/Address/1/AddressLine1/1', 'entities/1/attributes/Address/1']
80
- }
81
- ],
82
- objectURI: 'entities/1'
83
- },
84
- refRelation: {
85
- type: 'configuration/relationTypes/HasAddress',
86
- crosswalks: [
87
- {
88
- uri: 'entities/1/crosswalks/uAGtqeB.3VKnDCtBz',
89
- type: 'configuration/sources/HMS',
90
- value: 'cww2',
91
- createDate: '2020-09-02T16:19:12.943Z',
92
- updateDate: '2020-09-02T16:19:12.943Z',
93
- attributeURIs: ['entities/1/attributes/Address/1/Status/1', 'entities/1/attributes/Address/1']
94
- }
95
- ],
96
- startRefPinned: false,
97
- endRefPinned: false,
98
- startRefIgnored: false,
99
- endRefIgnored: false,
100
- objectURI: 'relations/1'
101
- },
102
- startObjectCrosswalks: [
115
+ ],
116
+ objectURI: 'entities/1'
117
+ },
118
+ refRelation: {
119
+ type: 'configuration/relationTypes/HasAddress',
120
+ crosswalks: [
103
121
  {
122
+ uri: 'entities/1/crosswalks/uAGtqeB.3VKnDCtBz',
104
123
  type: 'configuration/sources/HMS',
105
- value: 'cww1'
124
+ value: 'cww2',
125
+ createDate: '2020-09-02T16:19:12.943Z',
126
+ updateDate: '2020-09-02T16:19:12.943Z',
127
+ attributeURIs: ['entities/1/attributes/Address/1/Status/1', 'entities/1/attributes/Address/1']
106
128
  }
107
- ]
108
- };
109
- var props = {
110
- attributeType: attributeType,
111
- attributeValue: attributeValue,
112
- crosswalksMap: {},
113
- emptyTempAttributeUris: [],
114
- onPin: jest.fn(),
115
- onIgnore: jest.fn(),
116
- onEdit: jest.fn(),
117
- onDelete: jest.fn(),
118
- onAdd: jest.fn()
129
+ ],
130
+ startRefPinned: false,
131
+ endRefPinned: false,
132
+ startRefIgnored: false,
133
+ endRefIgnored: false,
134
+ objectURI: 'relations/1'
135
+ },
136
+ startObjectCrosswalks: [
137
+ {
138
+ type: 'configuration/sources/HMS',
139
+ value: 'cww1'
140
+ }
141
+ ]
142
+ };
143
+ var defaultProps = {
144
+ attributeType: attributeType,
145
+ attributeValue: attributeValue,
146
+ crosswalksMap: {},
147
+ emptyTempAttributeUris: [],
148
+ onPin: jest.fn(),
149
+ onIgnore: jest.fn(),
150
+ onEdit: jest.fn(),
151
+ onDelete: jest.fn(),
152
+ onAdd: jest.fn()
153
+ };
154
+ var setUp = function (props) {
155
+ if (props === void 0) { props = {}; }
156
+ var user = userEvent.setup();
157
+ var Providers = function (_a) {
158
+ var children = _a.children;
159
+ return (React.createElement(MdmModuleProvider, { values: { metadata: metadata, uiPath: 'https://tst-01.reltio.com/ui/tenant/' } },
160
+ React.createElement(DndContext, null, children)));
119
161
  };
120
- beforeAll(function () {
121
- useMdmMetadata.mockReturnValue(metadata);
122
- useMdmUiPath.mockReturnValue('https://tst-01.reltio.com/ui/tenant/');
123
- });
124
- it('should render correctly', function () {
125
- var wrapper = shallow(React.createElement(InlineReferenceAttribute, __assign({}, props)));
126
- expect(wrapper.find('InlineComplexAttribute').props()).toEqual(__assign(__assign({}, props), { attributeTypesList: attributes, label: (React.createElement(ComplexAttributeLabel, null,
127
- React.createElement(InternalLink, { href: 'https://tst-01.reltio.com/ui/tenant/#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/1' },
128
- "Granada Aveue Santa Clara 1",
129
- React.createElement("span", { className: "relationshipLabel" }, "Office")))) }));
130
- });
162
+ return __assign({ user: user }, render(React.createElement(InlineReferenceAttribute, __assign({}, defaultProps, props)), { wrapper: Providers }));
163
+ };
164
+ describe('InlineReferenceAttribute tests', function () {
165
+ it('should render correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
166
+ var user, link, expandButton;
167
+ return __generator(this, function (_a) {
168
+ switch (_a.label) {
169
+ case 0:
170
+ user = setUp().user;
171
+ link = screen.getByRole('link');
172
+ expect(link).toHaveAttribute('href', 'https://tst-01.reltio.com/ui/tenant/#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/1');
173
+ expect(link).toHaveTextContent('Granada Aveue Santa Clara 1');
174
+ expect(screen.queryByText('Customer Address Status')).not.toBeInTheDocument();
175
+ expect(screen.queryByTestId('simple-attributes-wrapper')).not.toBeInTheDocument();
176
+ expandButton = screen.getByTestId('arrow-expand-button');
177
+ expect(expandButton).toBeInTheDocument();
178
+ expect(expandButton.querySelector('svg')).not.toHaveClass('expanded');
179
+ return [4 /*yield*/, user.click(expandButton)];
180
+ case 1:
181
+ _a.sent();
182
+ expect(screen.getByText('Customer Address Status')).toBeInTheDocument();
183
+ expect(screen.getByTestId('simple-attributes-wrapper')).toBeInTheDocument();
184
+ expect(expandButton.querySelector('svg')).toHaveClass('expanded');
185
+ return [2 /*return*/];
186
+ }
187
+ });
188
+ }); });
131
189
  });