@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,46 +9,116 @@ 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 { act } from 'react-dom/test-utils';
14
- 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';
15
52
  import { InlineAttributesPager } from './InlineAttributesPager';
16
- describe('InlineAttributesPager tests', function () {
17
- var props = {
18
- parentUri: 'entities/1',
19
- crosswalksMap: {},
20
- onPin: jest.fn(),
21
- onIgnore: jest.fn(),
22
- onEdit: jest.fn(),
23
- onDelete: jest.fn(),
24
- onAdd: jest.fn(),
25
- emptyTempAttributeUris: []
53
+ jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { debounce: function (x) { return x; } })); });
54
+ var simpleAttributeType = {
55
+ uri: 'configuration/entityTypes/HCP/attributes/Simple',
56
+ type: 'String',
57
+ name: 'Simple',
58
+ label: 'Simple label'
59
+ };
60
+ var crosswalks = [
61
+ {
62
+ uri: 'entities/sIeHttl/crosswalks/12jf9nL05',
63
+ type: 'configuration/sources/Reltio',
64
+ value: 'nQpZyQt',
65
+ reltioLoadDate: '2021-06-11T08:24:31.726Z',
66
+ createDate: '2018-11-19T12:14:00.735Z',
67
+ updateDate: '2018-11-19T12:14:00.735Z',
68
+ attributes: ['entities/sIeHttl/attributes/Simple/u123', 'entities/sIeHttl/attributes/Simple/u789'],
69
+ singleAttributeUpdateDates: {
70
+ 'entities/sIeHttl/attributes/Date/1': '2018-11-29T05:39:56.445Z'
71
+ }
72
+ }
73
+ ];
74
+ var defaultProps = {
75
+ attributeType: simpleAttributeType,
76
+ attributeValues: [],
77
+ parentUri: 'entities/sIeHttl',
78
+ crosswalksMap: {},
79
+ onPin: jest.fn(),
80
+ onIgnore: jest.fn(),
81
+ onEdit: jest.fn(),
82
+ onDelete: jest.fn(),
83
+ onAdd: jest.fn(),
84
+ emptyTempAttributeUris: []
85
+ };
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(DndContext, null, children);
26
92
  };
27
- it('should render simple attributes correctly', function () {
28
- var attributeType = {
29
- uri: 'configuration/entityTypes/HCP/attributes/Simple',
30
- type: 'String',
31
- name: 'Simple',
32
- label: 'Simple label'
93
+ return __assign({ user: user }, render(React.createElement(InlineAttributesPager, __assign({}, defaultProps, props)), { wrapper: Providers }));
94
+ };
95
+ describe('InlineAttributesPager tests', function () {
96
+ describe('simple', function () {
97
+ var crosswalksMap = {
98
+ 'entities/sIeHttl/attributes/Simple/u123': [crosswalks[0]],
99
+ 'entities/sIeHttl/attributes/Simple/u789': [crosswalks[0]]
33
100
  };
34
101
  var attributeValues = [
35
102
  {
36
- type: attributeType.uri,
103
+ type: simpleAttributeType.uri,
37
104
  uri: 'entities/sIeHttl/attributes/Simple/u123',
38
105
  value: '123',
39
106
  ov: true
40
107
  },
41
108
  {
42
- type: attributeType.uri,
109
+ type: simpleAttributeType.uri,
43
110
  uri: 'entities/sIeHttl/attributes/Simple/u789',
44
111
  value: '789',
45
112
  ov: false
46
113
  }
47
114
  ];
48
- var wrapper = shallow(React.createElement(InlineAttributesPager, __assign({ attributeType: attributeType, attributeValues: attributeValues }, props)));
49
- expect(wrapper.find('InlineSimpleAttributesBlock').props()).toEqual(__assign(__assign({}, props), { attributeType: attributeType, attributeValues: attributeValues }));
115
+ it('should render simple attributes correctly', function () {
116
+ setUp({ attributeType: simpleAttributeType, attributeValues: attributeValues, crosswalksMap: crosswalksMap });
117
+ expect(screen.getByText('123')).toBeInTheDocument();
118
+ expect(screen.getByText('789')).toBeInTheDocument();
119
+ });
50
120
  });
51
- it('should render nested attributes correctly', function () {
121
+ describe('nested', function () {
52
122
  var attributeType = {
53
123
  uri: 'configuration/entityTypes/HCP/attributes/Nested',
54
124
  type: 'Nested',
@@ -66,6 +136,7 @@ describe('InlineAttributesPager tests', function () {
66
136
  var attributeValues = [
67
137
  {
68
138
  type: attributeType.uri,
139
+ label: 'Attribute Label',
69
140
  uri: 'entities/sIeHttl/attributes/Nested/u123',
70
141
  value: {
71
142
  SubNested: [
@@ -79,6 +150,7 @@ describe('InlineAttributesPager tests', function () {
79
150
  },
80
151
  {
81
152
  type: attributeType.uri,
153
+ label: 'Attribute Label 2',
82
154
  uri: 'entities/sIeHttl/attributes/Nested/u789',
83
155
  value: {
84
156
  SubNested: [
@@ -91,144 +163,202 @@ describe('InlineAttributesPager tests', function () {
91
163
  ov: false
92
164
  }
93
165
  ];
94
- var wrapper = shallow(React.createElement(InlineAttributesPager, __assign({ attributeType: attributeType, attributeValues: attributeValues }, props)));
95
- expect(wrapper.find('InlineNestedAttributesBlock').props()).toEqual(__assign(__assign({}, props), { attributeType: attributeType, attributeValues: attributeValues, className: 'complexAttributesWrapper' }));
166
+ it('should render nested attributes correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
167
+ var user, expandButtons;
168
+ return __generator(this, function (_a) {
169
+ switch (_a.label) {
170
+ case 0:
171
+ user = setUp({ attributeType: attributeType, attributeValues: attributeValues }).user;
172
+ expect(screen.getByText('Attribute Label')).toBeInTheDocument();
173
+ expect(screen.getByText('Attribute Label 2')).toBeInTheDocument();
174
+ expect(screen.queryByText('SubNested label')).not.toBeInTheDocument();
175
+ expandButtons = screen.getAllByTestId('arrow-expand-button');
176
+ return [4 /*yield*/, user.click(expandButtons[0])];
177
+ case 1:
178
+ _a.sent();
179
+ expect(screen.getByText('SubNested label')).toBeInTheDocument();
180
+ return [2 /*return*/];
181
+ }
182
+ });
183
+ }); });
184
+ it('should render create button if values are empty', function () {
185
+ setUp({ attributeType: attributeType, attributeValues: [] });
186
+ expect(screen.getByText('Create attribute')).toBeInTheDocument();
187
+ });
188
+ it('should not render create button if values are empty but not editable', function () {
189
+ setUp({ attributeType: attributeType, attributeValues: [], disableEdit: true });
190
+ expect(screen.queryByText('Create attribute')).not.toBeInTheDocument();
191
+ });
192
+ it('should call onAdd on create button click', function () { return __awaiter(void 0, void 0, void 0, function () {
193
+ var user;
194
+ return __generator(this, function (_a) {
195
+ switch (_a.label) {
196
+ case 0:
197
+ user = setUp({ attributeType: attributeType, attributeValues: [] }).user;
198
+ return [4 /*yield*/, user.click(screen.getByText('Create attribute'))];
199
+ case 1:
200
+ _a.sent();
201
+ expect(defaultProps.onAdd).toHaveBeenCalledWith({
202
+ parentUri: defaultProps.parentUri,
203
+ attributeType: attributeType,
204
+ index: 0
205
+ });
206
+ return [2 /*return*/];
207
+ }
208
+ });
209
+ }); });
96
210
  });
97
- it('should render reference attributes correctly', function () {
98
- var attributeType = {
99
- label: 'Address',
100
- name: 'Address',
101
- type: 'Reference',
102
- uri: 'configuration/entityTypes/HCP/attributes/Address',
103
- referencedAttributeURIs: ['configuration/entityTypes/Location/attributes/AddressLine1'],
104
- relationshipTypeURI: 'configuration/relationTypes/HasAddress'
105
- };
106
- var attributeValues = [
107
- {
108
- label: 'Granada Aveue Santa Clara 1',
109
- relationshipLabel: 'Office',
110
- value: {
111
- AddressLine1: [
112
- {
113
- type: 'configuration/entityTypes/Location/attributes/AddressLine1',
114
- ov: true,
115
- value: '3588 Granada Aveue',
116
- uri: 'entities/1/attributes/Address/1/AddressLine1/1'
117
- }
118
- ]
119
- },
120
- ov: true,
121
- uri: 'entities/1/attributes/Address/1',
122
- refEntity: {
123
- type: 'configuration/entityTypes/Location',
124
- crosswalks: [
125
- {
126
- uri: 'entities/1/crosswalks/1YWdmjzf.3VKnDCovj',
127
- type: 'configuration/sources/HMS',
128
- value: 'cww1',
129
- createDate: '2020-09-02T16:19:12.943Z',
130
- updateDate: '2020-09-02T16:19:12.943Z',
131
- attributeURIs: [
132
- 'entities/1/attributes/Address/1/AddressLine1/1',
133
- 'entities/1/attributes/Address/1'
134
- ]
135
- }
136
- ],
137
- objectURI: 'entities/1'
138
- },
139
- refRelation: {
140
- type: 'configuration/relationTypes/HasAddress',
141
- crosswalks: [
211
+ describe('reference', function () {
212
+ it('should render reference attributes correctly', function () {
213
+ var attributeType = {
214
+ label: 'Address',
215
+ name: 'Address',
216
+ type: 'Reference',
217
+ uri: 'configuration/entityTypes/HCP/attributes/Address',
218
+ referencedAttributeURIs: ['configuration/entityTypes/Location/attributes/AddressLine1'],
219
+ relationshipTypeURI: 'configuration/relationTypes/HasAddress'
220
+ };
221
+ var attributeValues = [
222
+ {
223
+ label: 'Granada Aveue Santa Clara 1',
224
+ relationshipLabel: 'Office',
225
+ value: {
226
+ AddressLine1: [
227
+ {
228
+ type: 'configuration/entityTypes/Location/attributes/AddressLine1',
229
+ ov: true,
230
+ value: '3588 Granada Aveue',
231
+ uri: 'entities/1/attributes/Address/1/AddressLine1/1'
232
+ }
233
+ ]
234
+ },
235
+ ov: true,
236
+ uri: 'entities/1/attributes/Address/1',
237
+ refEntity: {
238
+ type: 'configuration/entityTypes/Location',
239
+ crosswalks: [
240
+ {
241
+ uri: 'entities/1/crosswalks/1YWdmjzf.3VKnDCovj',
242
+ type: 'configuration/sources/HMS',
243
+ value: 'cww1',
244
+ createDate: '2020-09-02T16:19:12.943Z',
245
+ updateDate: '2020-09-02T16:19:12.943Z',
246
+ attributeURIs: [
247
+ 'entities/1/attributes/Address/1/AddressLine1/1',
248
+ 'entities/1/attributes/Address/1'
249
+ ]
250
+ }
251
+ ],
252
+ objectURI: 'entities/1'
253
+ },
254
+ refRelation: {
255
+ type: 'configuration/relationTypes/HasAddress',
256
+ crosswalks: [
257
+ {
258
+ uri: 'entities/1/crosswalks/uAGtqeB.3VKnDCtBz',
259
+ type: 'configuration/sources/HMS',
260
+ value: 'cww2',
261
+ createDate: '2020-09-02T16:19:12.943Z',
262
+ updateDate: '2020-09-02T16:19:12.943Z',
263
+ attributeURIs: [
264
+ 'entities/1/attributes/Address/1/AddressLine/1',
265
+ 'entities/1/attributes/Address/1'
266
+ ]
267
+ }
268
+ ],
269
+ startRefPinned: false,
270
+ endRefPinned: false,
271
+ startRefIgnored: false,
272
+ endRefIgnored: false,
273
+ objectURI: 'relations/1'
274
+ },
275
+ startObjectCrosswalks: [
142
276
  {
143
- uri: 'entities/1/crosswalks/uAGtqeB.3VKnDCtBz',
144
277
  type: 'configuration/sources/HMS',
145
- value: 'cww2',
146
- createDate: '2020-09-02T16:19:12.943Z',
147
- updateDate: '2020-09-02T16:19:12.943Z',
148
- attributeURIs: [
149
- 'entities/1/attributes/Address/1/AddressLine/1',
150
- 'entities/1/attributes/Address/1'
151
- ]
152
- }
153
- ],
154
- startRefPinned: false,
155
- endRefPinned: false,
156
- startRefIgnored: false,
157
- endRefIgnored: false,
158
- objectURI: 'relations/1'
159
- }
160
- },
161
- {
162
- label: 'Granada Aveue Santa Clara 2',
163
- relationshipLabel: 'Office',
164
- value: {
165
- AddressLine1: [
166
- {
167
- type: 'configuration/entityTypes/Location/attributes/AddressLine1',
168
- ov: true,
169
- value: '3587 Granada Aveue',
170
- uri: 'entities/1/attributes/Address/2/AddressLine1/1'
278
+ value: 'cww1'
171
279
  }
172
280
  ]
173
281
  },
174
- ov: true,
175
- uri: 'entities/1/attributes/Address/2',
176
- refEntity: {
177
- type: 'configuration/entityTypes/Location',
178
- crosswalks: [
179
- {
180
- uri: 'entities/1/crosswalks/1YWdmsWB.3VKnDDe4p',
181
- type: 'configuration/sources/HMS',
182
- value: 'cwf1',
183
- createDate: '2020-09-02T16:19:12.943Z',
184
- updateDate: '2020-09-02T16:19:12.943Z',
185
- attributeURIs: [
186
- 'entities/1/attributes/Address/2/AddressLine1/1',
187
- 'entities/1/attributes/Address/2'
188
- ]
189
- }
190
- ],
191
- objectURI: 'entities/1'
192
- },
193
- refRelation: {
194
- type: 'configuration/relationTypes/HasAddress',
195
- crosswalks: [
282
+ {
283
+ label: 'Granada Aveue Santa Clara 2',
284
+ relationshipLabel: 'Office',
285
+ value: {
286
+ AddressLine1: [
287
+ {
288
+ type: 'configuration/entityTypes/Location/attributes/AddressLine1',
289
+ ov: true,
290
+ value: '3587 Granada Aveue',
291
+ uri: 'entities/1/attributes/Address/2/AddressLine1/1'
292
+ }
293
+ ]
294
+ },
295
+ ov: true,
296
+ uri: 'entities/1/attributes/Address/2',
297
+ refEntity: {
298
+ type: 'configuration/entityTypes/Location',
299
+ crosswalks: [
300
+ {
301
+ uri: 'entities/1/crosswalks/1YWdmsWB.3VKnDDe4p',
302
+ type: 'configuration/sources/HMS',
303
+ value: 'cwf1',
304
+ createDate: '2020-09-02T16:19:12.943Z',
305
+ updateDate: '2020-09-02T16:19:12.943Z',
306
+ attributeURIs: [
307
+ 'entities/1/attributes/Address/2/AddressLine1/1',
308
+ 'entities/1/attributes/Address/2'
309
+ ]
310
+ }
311
+ ],
312
+ objectURI: 'entities/1'
313
+ },
314
+ refRelation: {
315
+ type: 'configuration/relationTypes/HasAddress',
316
+ crosswalks: [
317
+ {
318
+ uri: 'entities/1/crosswalks/uAGtuuR.3VKnDDiL5',
319
+ type: 'configuration/sources/HMS',
320
+ value: 'cwf2',
321
+ createDate: '2020-09-02T16:19:12.943Z',
322
+ updateDate: '2020-09-02T16:19:12.943Z',
323
+ attributeURIs: [
324
+ 'entities/1/attributes/Address/2/AddressLine1/1',
325
+ 'entities/1/attributes/Address/2'
326
+ ]
327
+ }
328
+ ],
329
+ startRefPinned: false,
330
+ endRefPinned: false,
331
+ startRefIgnored: false,
332
+ endRefIgnored: false,
333
+ objectURI: 'relations/2'
334
+ },
335
+ startObjectCrosswalks: [
196
336
  {
197
- uri: 'entities/1/crosswalks/uAGtuuR.3VKnDDiL5',
198
337
  type: 'configuration/sources/HMS',
199
- value: 'cwf2',
200
- createDate: '2020-09-02T16:19:12.943Z',
201
- updateDate: '2020-09-02T16:19:12.943Z',
202
- attributeURIs: [
203
- 'entities/1/attributes/Address/2/AddressLine1/1',
204
- 'entities/1/attributes/Address/2'
205
- ]
338
+ value: 'cfw1'
206
339
  }
207
- ],
208
- startRefPinned: false,
209
- endRefPinned: false,
210
- startRefIgnored: false,
211
- endRefIgnored: false,
212
- objectURI: 'relations/2'
340
+ ]
213
341
  }
342
+ ];
343
+ setUp({ attributeType: attributeType, attributeValues: attributeValues });
344
+ expect(screen.getAllByTestId('inline-complex-attribute')).toHaveLength(2);
345
+ expect(screen.getByText('Granada Aveue Santa Clara 1')).toBeInTheDocument();
346
+ expect(screen.getByText('Granada Aveue Santa Clara 2')).toBeInTheDocument();
347
+ expect(screen.getAllByText('Office')).toHaveLength(2);
348
+ });
349
+ });
350
+ describe('image', function () {
351
+ var crosswalks = [
352
+ {
353
+ uri: 'entities/j8K1vc9/crosswalks/12jf9nL05',
354
+ type: 'configuration/sources/Reltio',
355
+ value: 'nQpZyQt',
356
+ reltioLoadDate: '2021-06-11T08:24:31.726Z',
357
+ createDate: '2018-11-19T12:14:00.735Z',
358
+ updateDate: '2018-11-19T12:14:00.735Z',
359
+ attributes: ['configuration/entityTypes/Employee/attributes/ImageGallery/attributes/UrlThumbnail']
214
360
  }
215
361
  ];
216
- var wrapper = shallow(React.createElement(InlineAttributesPager, __assign({ attributeType: attributeType, attributeValues: attributeValues }, props)));
217
- expect(wrapper.find('InlineReferenceAttributesBlock').props()).toEqual(__assign(__assign({}, props), { attributeType: attributeType, attributeValues: attributeValues, className: 'complexAttributesWrapper' }));
218
- });
219
- it('should render image attributes correctly', function () {
220
- var attributeType = {
221
- attributes: [
222
- {
223
- name: 'UrlThumbnail',
224
- type: 'String',
225
- uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/UrlThumbnail'
226
- }
227
- ],
228
- name: 'ImageGallery',
229
- type: 'Image',
230
- uri: 'configuration/entityTypes/Employee/attributes/ImageGallery'
231
- };
232
362
  var attributeValues = [
233
363
  {
234
364
  type: 'configuration/entityTypes/Employee/attributes/ImageGallery',
@@ -261,8 +391,45 @@ describe('InlineAttributesPager tests', function () {
261
391
  ov: true
262
392
  }
263
393
  ];
264
- var wrapper = shallow(React.createElement(InlineAttributesPager, __assign({ attributeType: attributeType, attributeValues: attributeValues }, props)));
265
- expect(wrapper.find('InlineImageAttributesBlock').props()).toEqual(__assign(__assign({}, props), { attributeType: attributeType, attributeValues: attributeValues, className: 'complexAttributesWrapper' }));
394
+ var attributeType = {
395
+ attributes: [
396
+ {
397
+ name: 'UrlThumbnail',
398
+ type: 'String',
399
+ label: 'Thumbnail',
400
+ uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/UrlThumbnail'
401
+ }
402
+ ],
403
+ name: 'ImageGallery',
404
+ type: 'Image',
405
+ uri: 'configuration/entityTypes/Employee/attributes/ImageGallery'
406
+ };
407
+ var crosswalksMap = {
408
+ 'entities/1Rd2I9Mt/attributes/ImageGallery/123123': [crosswalks[0]],
409
+ 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv': [crosswalks[0]]
410
+ };
411
+ it('should render image attributes correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
412
+ var user, images;
413
+ return __generator(this, function (_a) {
414
+ switch (_a.label) {
415
+ case 0:
416
+ user = setUp({ attributeType: attributeType, attributeValues: attributeValues, crosswalksMap: crosswalksMap }).user;
417
+ images = screen.getAllByRole('img');
418
+ expect(images).toHaveLength(2);
419
+ expect(images[0]).toHaveAttribute('src', '/test123.jpg');
420
+ expect(images[1]).toHaveAttribute('src', '/test.jpg');
421
+ expect(screen.getAllByTestId('inline-complex-attribute')).toHaveLength(2);
422
+ expect(screen.getAllByTestId('arrow-expand-button')).toHaveLength(2);
423
+ return [4 /*yield*/, user.hover(images[0])];
424
+ case 1:
425
+ _a.sent();
426
+ expect(screen.getByLabelText('Pin')).toBeInTheDocument();
427
+ expect(screen.getByLabelText('Delete')).toBeInTheDocument();
428
+ expect(screen.getByLabelText('Ignore')).toBeInTheDocument();
429
+ return [2 /*return*/];
430
+ }
431
+ });
432
+ }); });
266
433
  });
267
434
  describe('paging', function () {
268
435
  var attributeType = {
@@ -271,38 +438,81 @@ describe('InlineAttributesPager tests', function () {
271
438
  name: 'Simple',
272
439
  label: 'Simple label'
273
440
  };
274
- var attributeValues = [
275
- {
276
- type: attributeType.uri,
277
- uri: 'entities/sIeHttl/attributes/Simple/u123',
278
- value: '123',
279
- ov: true
280
- },
281
- {
282
- type: attributeType.uri,
283
- uri: 'entities/sIeHttl/attributes/Simple/u789',
284
- value: '789',
285
- ov: false
286
- }
287
- ];
288
- it('should show Show more button if has more attributes to show', function () {
289
- var wrapper = shallow(React.createElement(InlineAttributesPager, __assign({ attributeType: attributeType, attributeValues: attributeValues, paging: {
290
- totalValues: 5
291
- }, max: 2 }, props)));
292
- var showMoreButton = wrapper.find('ShowMore');
293
- expect(showMoreButton.prop('moreNumber')).toBe(2);
294
- expect(showMoreButton.prop('valueNumber')).toBe(3);
295
- });
296
- it('should show Show less button if has no more attributes to show', function () {
297
- var wrapper = shallow(React.createElement(InlineAttributesPager, __assign({ attributeType: attributeType, attributeValues: attributeValues, paging: {
298
- totalValues: 2
299
- }, max: 1 }, props)));
300
- expect(wrapper.find('ShowLess')).toHaveLength(0);
301
- act(function () {
302
- wrapper.find('ShowMore').simulate('click');
441
+ var attributeValues = Array.from({ length: 5 }, function (_, i) { return ({
442
+ type: attributeType.uri,
443
+ uri: "entities/sIeHttl/attributes/Simple/u".concat(i + 1),
444
+ value: "u".concat(i + 1),
445
+ ov: i === 0
446
+ }); });
447
+ var crosswalksMap = attributeValues.reduce(function (acc, value) {
448
+ acc[value.uri] = [crosswalks[0]];
449
+ return acc;
450
+ }, {});
451
+ it('should show Show more button if has more attributes to show', function () { return __awaiter(void 0, void 0, void 0, function () {
452
+ var user;
453
+ return __generator(this, function (_a) {
454
+ switch (_a.label) {
455
+ case 0:
456
+ user = setUp({
457
+ crosswalksMap: crosswalksMap,
458
+ attributeType: attributeType,
459
+ attributeValues: attributeValues,
460
+ paging: { totalValues: 5 },
461
+ max: 2
462
+ }).user;
463
+ expect(screen.getByText('u1')).toBeInTheDocument();
464
+ expect(screen.getByText('u2')).toBeInTheDocument();
465
+ expect(screen.queryByText('u3')).not.toBeInTheDocument();
466
+ expect(screen.queryByText('u4')).not.toBeInTheDocument();
467
+ expect(screen.queryByText('u5')).not.toBeInTheDocument();
468
+ expect(screen.queryByText('Show less')).not.toBeInTheDocument();
469
+ return [4 /*yield*/, user.click(screen.getByText('Show 2 more of remaining 3 value'))];
470
+ case 1:
471
+ _a.sent();
472
+ expect(screen.queryByText('Show less')).not.toBeInTheDocument();
473
+ expect(screen.getByText('u3')).toBeInTheDocument();
474
+ expect(screen.getByText('u4')).toBeInTheDocument();
475
+ expect(screen.queryByText('u5')).not.toBeInTheDocument();
476
+ return [4 /*yield*/, user.click(screen.getByText('Show 1 more of remaining 1 value'))];
477
+ case 2:
478
+ _a.sent();
479
+ expect(screen.getByText('Show less')).toBeInTheDocument();
480
+ expect(screen.getByText('u5')).toBeInTheDocument();
481
+ return [2 /*return*/];
482
+ }
303
483
  });
304
- expect(wrapper.find('ShowMore')).toHaveLength(0);
305
- expect(wrapper.find('ShowLess')).toHaveLength(1);
306
- });
484
+ }); });
485
+ it('should show Show less button if has no more attributes to show', function () { return __awaiter(void 0, void 0, void 0, function () {
486
+ var user;
487
+ return __generator(this, function (_a) {
488
+ switch (_a.label) {
489
+ case 0:
490
+ user = setUp({
491
+ crosswalksMap: crosswalksMap,
492
+ attributeType: attributeType,
493
+ attributeValues: attributeValues,
494
+ paging: { totalValues: 5 },
495
+ max: 2
496
+ }).user;
497
+ return [4 /*yield*/, user.click(screen.getByText('Show 2 more of remaining 3 value'))];
498
+ case 1:
499
+ _a.sent();
500
+ return [4 /*yield*/, user.click(screen.getByText('Show 1 more of remaining 1 value'))];
501
+ case 2:
502
+ _a.sent();
503
+ return [4 /*yield*/, user.click(screen.getByText('Show less'))];
504
+ case 3:
505
+ _a.sent();
506
+ expect(screen.getByText('u1')).toBeInTheDocument();
507
+ expect(screen.getByText('u2')).toBeInTheDocument();
508
+ expect(screen.queryByText('u3')).not.toBeInTheDocument();
509
+ expect(screen.queryByText('u4')).not.toBeInTheDocument();
510
+ expect(screen.queryByText('u5')).not.toBeInTheDocument();
511
+ expect(screen.queryByText('Show less')).not.toBeInTheDocument();
512
+ expect(screen.getByText('Show 2 more of remaining 3 value')).toBeInTheDocument();
513
+ return [2 /*return*/];
514
+ }
515
+ });
516
+ }); });
307
517
  });
308
518
  });