@reltio/components 1.4.2071 → 1.4.2073

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 (196) hide show
  1. package/AttributesView/AttributesView.js +1 -1
  2. package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -3
  3. package/ColumnsSettings/helpers.d.ts +3 -1
  4. package/ColumnsSettings/types.d.ts +8 -0
  5. package/CommentsContainer/CommentsContainer.js +1 -1
  6. package/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +23 -40
  7. package/ConfigureColumnsPopup/ConfigureColumnsPopup.js +6 -26
  8. package/EditModeAttributesList/EditModeAttributesList.js +1 -1
  9. package/EditModeAttributesPager/EditModeAttributesPager.test.js +1 -1
  10. package/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.js +1 -1
  11. package/MetadataTypesSelector/MetadataTypesSelector.d.ts +2 -1
  12. package/MetadataTypesSelector/components/SelectMetadataTypesList/SelectMetadataTypesList.d.ts +5 -6
  13. package/MoreAttributesButton/useMoreAttributesItems.d.ts +1 -1
  14. package/ReadOnlyAttributesList/ReadOnlyAttributesList.js +1 -1
  15. package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +1 -1
  16. package/ReadOnlyAttributesView/ReadOnlyAttributesView.js +1 -1
  17. package/ScrollableTabs/ScrollableTabs.test.js +69 -19
  18. package/SearchHighlighter/SearchHighlighter.test.js +18 -7
  19. package/SelectAttributesList/SelectAttributesList.d.ts +11 -6
  20. package/SelectAttributesList/SelectAttributesList.js +5 -2
  21. package/SelectorWithOnlyOptionAutoSelect/SelectorWithOnlyOptionAutoSelect.test.js +109 -60
  22. package/SidePanelContentHeader/SidePanelContentHeader.js +2 -2
  23. package/SidePanelContentHeader/SidePanelContentHeader.test.js +104 -0
  24. package/SidePanelEmptyState/SidePanelEmptyState.js +1 -1
  25. package/SidePanelEmptyState/SidePanelEmptyState.test.js +24 -0
  26. package/SimpleAttribute/SimpleAttribute.js +1 -1
  27. package/SimpleAttribute/SimpleAttribute.test.js +155 -80
  28. package/SimpleAttributeEditor/SimpleAttributeEditor.test.js +339 -330
  29. package/SimpleAttributeEditor/useAttributeValuePermissions.js +1 -1
  30. package/SimpleDropDownSelector/SimpleDropDownSelector.test.js +86 -10
  31. package/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.js +1 -1
  32. package/SimpleDropDownSelector/components/DropDownValue/DropDownValue.js +1 -1
  33. package/SimpleMatchRulesBlock/SimpleMatchRulesBlock.test.js +128 -32
  34. package/SmallIconButton/SmallIconButton.test.js +98 -25
  35. package/TableWithBars/TableWithBars.test.js +98 -60
  36. package/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.js +1 -1
  37. package/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.js +1 -1
  38. package/Tags/Tags.d.ts +0 -1
  39. package/Tags/Tags.test.js +8 -7
  40. package/TransitiveMatchBlock/TransitiveMatchBlock.test.js +78 -22
  41. package/TransitiveMatchRule/TransitiveMatchRule.test.js +78 -37
  42. package/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.js +1 -1
  43. package/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.test.js +12 -18
  44. package/UploadFileButton/UploadFileButton.d.ts +2 -2
  45. package/UploadFileButton/UploadFileButton.test.js +199 -0
  46. package/UploadImageDialog/UploadImageDialog.test.js +1 -0
  47. package/UploadImageDialog/components/DividerWithText/DividerWithText.js +1 -1
  48. package/UploadImageDialog/components/ErrorSnackbar/ErrorSnackbar.test.js +80 -22
  49. package/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.js +1 -1
  50. package/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.test.js +162 -49
  51. package/ValueChip/ValueChip.test.js +7 -23
  52. package/VirtualGroupedList/VirtualGroupedList.d.ts +19 -31
  53. package/VirtualGroupedList/VirtualGroupedList.js +11 -36
  54. package/VirtualGroupedList/VirtualGroupedList.test.js +224 -0
  55. package/VirtualGroupedList/helpers.d.ts +7 -2
  56. package/VirtualGroupedList/helpers.js +3 -1
  57. package/VirtualGroupedList/index.d.ts +1 -1
  58. package/VirtualGroupedList/types.d.ts +10 -6
  59. package/VirtualGroupedList/useScrollToFocusItem.d.ts +8 -5
  60. package/WhiteSearchInput/{WhiteSearchInput.spec.js → WhiteSearchInput.test.js} +3 -8
  61. package/cjs/AttributesView/AttributesView.js +2 -2
  62. package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -3
  63. package/cjs/ColumnsSettings/helpers.d.ts +3 -1
  64. package/cjs/ColumnsSettings/types.d.ts +8 -0
  65. package/cjs/ColumnsSettings/types.js +2 -0
  66. package/cjs/CommentsContainer/CommentsContainer.js +1 -1
  67. package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.d.ts +23 -40
  68. package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.js +6 -26
  69. package/cjs/EditModeAttributesList/EditModeAttributesList.js +2 -2
  70. package/cjs/EditModeAttributesPager/EditModeAttributesPager.test.js +2 -2
  71. package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.js +2 -2
  72. package/cjs/MetadataTypesSelector/MetadataTypesSelector.d.ts +2 -1
  73. package/cjs/MetadataTypesSelector/components/SelectMetadataTypesList/SelectMetadataTypesList.d.ts +5 -6
  74. package/cjs/MoreAttributesButton/useMoreAttributesItems.d.ts +1 -1
  75. package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.js +2 -2
  76. package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.js +2 -2
  77. package/cjs/ReadOnlyAttributesView/ReadOnlyAttributesView.js +2 -2
  78. package/cjs/ScrollableTabs/ScrollableTabs.test.js +69 -19
  79. package/cjs/SearchHighlighter/SearchHighlighter.test.js +18 -7
  80. package/cjs/SelectAttributesList/SelectAttributesList.d.ts +11 -6
  81. package/cjs/SelectAttributesList/SelectAttributesList.js +5 -2
  82. package/cjs/SelectorWithOnlyOptionAutoSelect/SelectorWithOnlyOptionAutoSelect.test.js +109 -60
  83. package/cjs/SidePanelContentHeader/SidePanelContentHeader.js +2 -2
  84. package/cjs/SidePanelContentHeader/SidePanelContentHeader.test.js +109 -0
  85. package/cjs/SidePanelEmptyState/SidePanelEmptyState.js +1 -1
  86. package/cjs/SidePanelEmptyState/SidePanelEmptyState.test.js +29 -0
  87. package/cjs/SimpleAttribute/SimpleAttribute.js +1 -1
  88. package/cjs/SimpleAttribute/SimpleAttribute.test.js +155 -80
  89. package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.test.js +338 -352
  90. package/cjs/SimpleAttributeEditor/useAttributeValuePermissions.js +2 -2
  91. package/cjs/SimpleDropDownSelector/SimpleDropDownSelector.test.js +86 -10
  92. package/cjs/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.js +1 -1
  93. package/cjs/SimpleDropDownSelector/components/DropDownValue/DropDownValue.js +1 -1
  94. package/cjs/SimpleMatchRulesBlock/SimpleMatchRulesBlock.test.js +127 -31
  95. package/cjs/SmallIconButton/SmallIconButton.test.js +98 -25
  96. package/cjs/TableWithBars/TableWithBars.test.js +98 -60
  97. package/cjs/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.js +1 -1
  98. package/cjs/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.js +1 -1
  99. package/cjs/Tags/Tags.d.ts +0 -1
  100. package/cjs/Tags/Tags.test.js +8 -7
  101. package/cjs/TransitiveMatchBlock/TransitiveMatchBlock.test.js +77 -21
  102. package/cjs/TransitiveMatchRule/TransitiveMatchRule.test.js +78 -37
  103. package/cjs/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.js +1 -1
  104. package/cjs/TransitiveMatchRulesTooltip/TransitiveMatchRulesTooltip.test.js +12 -18
  105. package/cjs/UploadFileButton/UploadFileButton.d.ts +2 -2
  106. package/cjs/UploadFileButton/UploadFileButton.test.js +204 -0
  107. package/cjs/UploadImageDialog/UploadImageDialog.test.js +1 -0
  108. package/cjs/UploadImageDialog/components/DividerWithText/DividerWithText.js +1 -1
  109. package/cjs/UploadImageDialog/components/ErrorSnackbar/ErrorSnackbar.test.js +80 -22
  110. package/cjs/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.js +1 -1
  111. package/cjs/UploadImageDialog/components/ImageByUrlField/ImageByUrlField.test.js +162 -49
  112. package/cjs/ValueChip/ValueChip.test.js +7 -23
  113. package/cjs/VirtualGroupedList/VirtualGroupedList.d.ts +19 -31
  114. package/cjs/VirtualGroupedList/VirtualGroupedList.js +11 -36
  115. package/cjs/VirtualGroupedList/VirtualGroupedList.test.js +252 -0
  116. package/cjs/VirtualGroupedList/helpers.d.ts +7 -2
  117. package/cjs/VirtualGroupedList/helpers.js +3 -1
  118. package/cjs/VirtualGroupedList/index.d.ts +1 -1
  119. package/cjs/VirtualGroupedList/types.d.ts +10 -6
  120. package/cjs/VirtualGroupedList/useScrollToFocusItem.d.ts +8 -5
  121. package/cjs/WhiteSearchInput/{WhiteSearchInput.spec.js → WhiteSearchInput.test.js} +3 -8
  122. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -0
  123. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +5 -0
  124. package/cjs/features/activity-log/ActivityFilterEditor/helpers.js +2 -1
  125. package/cjs/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -1
  126. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +16 -15
  127. package/cjs/features/activity-log/types.d.ts +1 -0
  128. package/cjs/features/activity-log/types.js +1 -0
  129. package/cjs/features/activity-log/utils/activities.js +1 -0
  130. package/cjs/features/activity-log/utils/filters.js +5 -1
  131. package/cjs/features/activity-log/utils/filters.test.js +4 -2
  132. package/cjs/features/crosswalks/hooks/useAttributeActions.test.js +24 -25
  133. package/cjs/features/crosswalks/hooks/useCrosswalkActions.test.js +10 -11
  134. package/cjs/features/history/types.d.ts +1 -0
  135. package/cjs/features/workflow/hooks/useChangeRequest.test.js +5 -6
  136. package/cjs/hooks/useCommentsEntitiesMap/useCommentsEntitiesMap.test.js +8 -9
  137. package/cjs/hooks/useKeyboardNavigation/useKeyboardNavigation.d.ts +9 -13
  138. package/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -0
  139. package/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +5 -0
  140. package/features/activity-log/ActivityFilterEditor/helpers.js +2 -1
  141. package/features/activity-log/ActivityFilterEditor/helpers.test.js +3 -1
  142. package/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +16 -15
  143. package/features/activity-log/types.d.ts +1 -0
  144. package/features/activity-log/types.js +1 -0
  145. package/features/activity-log/utils/activities.js +1 -0
  146. package/features/activity-log/utils/filters.js +5 -1
  147. package/features/activity-log/utils/filters.test.js +4 -2
  148. package/features/crosswalks/hooks/useAttributeActions.test.js +1 -2
  149. package/features/crosswalks/hooks/useCrosswalkActions.test.js +1 -2
  150. package/features/history/types.d.ts +1 -0
  151. package/features/workflow/hooks/useChangeRequest.test.js +1 -2
  152. package/hooks/useCommentsEntitiesMap/useCommentsEntitiesMap.test.js +1 -2
  153. package/hooks/useKeyboardNavigation/useKeyboardNavigation.d.ts +9 -13
  154. package/package.json +1 -1
  155. package/SidePanelContentHeader/SidePanelContentHeader.spec.js +0 -49
  156. package/SidePanelEmptyState/SidePanelEmptyState.spec.js +0 -24
  157. package/SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.js +0 -103
  158. package/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.js +0 -13
  159. package/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.js +0 -21
  160. package/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.js +0 -20
  161. package/UploadFileButton/UploadFileButton.spec.js +0 -219
  162. package/UploadImageDialog/components/DividerWithText/DividerWithText.test.js +0 -9
  163. package/VirtualGroupedList/VirtualGroupedList.spec.js +0 -282
  164. package/cjs/SidePanelContentHeader/SidePanelContentHeader.spec.js +0 -54
  165. package/cjs/SidePanelEmptyState/SidePanelEmptyState.spec.d.ts +0 -1
  166. package/cjs/SidePanelEmptyState/SidePanelEmptyState.spec.js +0 -29
  167. package/cjs/SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.d.ts +0 -1
  168. package/cjs/SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.js +0 -108
  169. package/cjs/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.d.ts +0 -1
  170. package/cjs/SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.js +0 -18
  171. package/cjs/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.d.ts +0 -1
  172. package/cjs/TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.js +0 -26
  173. package/cjs/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.d.ts +0 -1
  174. package/cjs/TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.js +0 -25
  175. package/cjs/UploadFileButton/UploadFileButton.spec.d.ts +0 -1
  176. package/cjs/UploadFileButton/UploadFileButton.spec.js +0 -224
  177. package/cjs/UploadImageDialog/components/DividerWithText/DividerWithText.test.d.ts +0 -1
  178. package/cjs/UploadImageDialog/components/DividerWithText/DividerWithText.test.js +0 -14
  179. package/cjs/VirtualGroupedList/VirtualGroupedList.spec.d.ts +0 -1
  180. package/cjs/VirtualGroupedList/VirtualGroupedList.spec.js +0 -287
  181. package/cjs/WhiteSearchInput/WhiteSearchInput.spec.d.ts +0 -1
  182. /package/{SidePanelContentHeader/SidePanelContentHeader.spec.d.ts → ColumnsSettings/types.js} +0 -0
  183. /package/{SidePanelEmptyState/SidePanelEmptyState.spec.d.ts → SidePanelContentHeader/SidePanelContentHeader.test.d.ts} +0 -0
  184. /package/{SimpleAttributeEditor/SimpleAttributeEditorWithoutPermissions.test.d.ts → SidePanelEmptyState/SidePanelEmptyState.test.d.ts} +0 -0
  185. /package/{SimpleDropDownSelector/components/DropDownPlaceholder/DropDownPlaceholder.test.d.ts → UploadFileButton/UploadFileButton.test.d.ts} +0 -0
  186. /package/{TableWithBars/components/AttributeCellRenderer/AttributeCellRenderer.test.d.ts → VirtualGroupedList/VirtualGroupedList.test.d.ts} +0 -0
  187. /package/{TableWithBars/components/HeadCellRenderer/HeadCellRenderer.test.d.ts → WhiteSearchInput/WhiteSearchInput.test.d.ts} +0 -0
  188. /package/{UploadFileButton/UploadFileButton.spec.d.ts → cjs/SidePanelContentHeader/SidePanelContentHeader.test.d.ts} +0 -0
  189. /package/{UploadImageDialog/components/DividerWithText/DividerWithText.test.d.ts → cjs/SidePanelEmptyState/SidePanelEmptyState.test.d.ts} +0 -0
  190. /package/{VirtualGroupedList/VirtualGroupedList.spec.d.ts → cjs/UploadFileButton/UploadFileButton.test.d.ts} +0 -0
  191. /package/{WhiteSearchInput/WhiteSearchInput.spec.d.ts → cjs/VirtualGroupedList/VirtualGroupedList.test.d.ts} +0 -0
  192. /package/cjs/{SidePanelContentHeader/SidePanelContentHeader.spec.d.ts → WhiteSearchInput/WhiteSearchInput.test.d.ts} +0 -0
  193. /package/cjs/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.d.ts +0 -0
  194. /package/cjs/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.js +0 -0
  195. /package/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.d.ts +0 -0
  196. /package/contexts/{AllwaysVisibleAttributesContext → AlwaysVisibleAttributesContext}/index.js +0 -0
@@ -9,85 +9,158 @@ 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 { mount, shallow } from 'enzyme';
14
- import { pick } from 'ramda';
15
- import { CollaborationObjectTypes, DataTypes } from '@reltio/mdm-sdk';
16
- import { DataTypeValue } from '../DataTypeValue';
17
- import { SimpleAttribute } from './SimpleAttribute';
49
+ import { render, screen } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
18
51
  import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../constants/classnames';
19
- import { CommentsContainer } from '../CommentsContainer';
20
52
  import { HistoryDiffContext } from '../contexts/HistoryAppearanceContext';
21
- import { PivotingTooltip } from '../PivotingTooltip';
22
53
  import { HighlightedValuesContext } from '../contexts/HighlightedValuesContext';
54
+ import { PivotingAttributeContext } from '../contexts/PivotingAttributeContext';
55
+ import { SimpleAttribute } from './SimpleAttribute';
56
+ import { CollaborationContext } from '../contexts/CollaborationContext';
23
57
  describe('SimpleAttribute tests', function () {
24
- var historyDiff = {
25
- appearance: { testAttributeUri: 'INSERT_ATTRIBUTE' },
26
- attributes: {},
27
- roles: [],
28
- tags: []
58
+ var defaultProps = {
59
+ attributeType: { type: 'String', name: 'Name', uri: 'URI' },
60
+ attributeValue: { value: '123', uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh' }
61
+ };
62
+ var defaultCollaborationContextValue = {
63
+ commentsMap: {},
64
+ currentComment: null
65
+ };
66
+ var defaultContextValues = {
67
+ collaboration: defaultCollaborationContextValue,
68
+ pivotingAttribute: undefined,
69
+ highlightedValues: {
70
+ highlightedValuesUris: [],
71
+ highlightedClassName: 'test'
72
+ },
73
+ historyDiff: {}
74
+ };
75
+ var setUp = function (props, contextValues) {
76
+ if (props === void 0) { props = {}; }
77
+ if (contextValues === void 0) { contextValues = {}; }
78
+ var user = userEvent.setup();
79
+ var _a = __assign(__assign({}, defaultContextValues), contextValues), pivotingAttribute = _a.pivotingAttribute, highlightedValues = _a.highlightedValues, historyDiff = _a.historyDiff, collaboration = _a.collaboration;
80
+ var Providers = function (_a) {
81
+ var children = _a.children;
82
+ return (React.createElement(CollaborationContext.Provider, { value: collaboration },
83
+ React.createElement(PivotingAttributeContext.Provider, { value: pivotingAttribute },
84
+ React.createElement(HighlightedValuesContext.Provider, { value: highlightedValues },
85
+ React.createElement(HistoryDiffContext.Provider, { value: historyDiff }, children)))));
86
+ };
87
+ return __assign({ user: user }, render(React.createElement(SimpleAttribute, __assign({}, defaultProps, props)), { wrapper: Providers }));
29
88
  };
30
89
  it('should render DataTypeValue', function () {
31
- var attrType = { type: 'String', name: 'Name', uri: 'URI' };
90
+ var attributeType = { type: 'String', name: 'Name', uri: 'URI' };
32
91
  var attributeValue = { value: '123', uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh' };
33
- var component = shallow(React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue }));
34
- var dataTypeValue = component.find(DataTypeValue);
35
- expect(dataTypeValue.length).toBe(1);
36
- expect(dataTypeValue.prop('value')).toEqual(attributeValue.value);
37
- expect(dataTypeValue.prop('dataTypeDefinition')).toEqual({ type: 'String', uri: 'URI', name: 'Name' });
92
+ setUp({ attributeType: attributeType, attributeValue: attributeValue });
93
+ expect(screen.getByTestId('reltio-attribute-value')).toHaveTextContent('123');
38
94
  });
39
- it('should provide correct props DataTypeValue if attribute is lookup', function () {
40
- var attrType = { type: 'String', dependentLookupCode: 'Code', name: 'Name', uri: 'URI', access: ['READ'] };
95
+ it('should render lookup correctly', function () {
96
+ var attributeType = { type: 'String', dependentLookupCode: 'Code', name: 'Name', uri: 'URI', access: ['READ'] };
41
97
  var attributeValue = {
42
- value: '123',
43
- lookupCode: '12',
44
- rawLookupCode: '34',
98
+ value: 'India',
99
+ lookupCode: 'IN',
100
+ rawLookupCode: 'IND',
45
101
  uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh'
46
102
  };
47
- var component = shallow(React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue }));
48
- var dataTypeValue = component.find(DataTypeValue);
49
- expect(dataTypeValue.length).toBe(1);
50
- expect(dataTypeValue.prop('value')).toEqual(pick(['value', 'lookupCode'], attributeValue));
51
- expect(dataTypeValue.prop('dataTypeDefinition')).toEqual(__assign({ access: ['READ'], type: 'String', dependentLookupCode: 'Code', uri: 'URI', name: 'Name' }, { type: DataTypes.TYPE_DEPENDENT_LOOKUP }));
52
- });
53
- it('should render CommentsContainer inside COMMENTS_CONTAINER_VISIBILITY_AREA with correct uri', function () {
54
- var attrType = { type: 'String', name: 'Name', uri: 'uri1' };
55
- var attributeValue = { value: '123', uri: 'entities/uri1/attributes/ABCD' };
56
- var component = shallow(React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue }));
57
- var commentsContainer = component.find(".".concat(COMMENTS_CONTAINER_VISIBILITY_AREA)).find(CommentsContainer);
58
- expect(commentsContainer.length).toBe(1);
59
- expect(commentsContainer.prop('uri')).toBe(attributeValue.uri);
60
- expect(commentsContainer.prop('relatedObjectUris')).toEqual(['entities/uri1']);
61
- expect(commentsContainer.prop('objectType')).toBe(CollaborationObjectTypes.ENTITY_ATTRIBUTE);
103
+ setUp({ attributeType: attributeType, attributeValue: attributeValue });
104
+ expect(screen.getByTestId('reltio-attribute-value')).toHaveTextContent('India (IN)');
62
105
  });
63
106
  it('should not render CommentsContainer if "inlined" prop is true', function () {
64
- var attrType = { type: 'String', name: 'Name', uri: 'uri1' };
107
+ var attributeType = { type: 'String', name: 'Name', uri: 'uri1' };
65
108
  var attributeValue = { value: '123', uri: 'uri1' };
66
- var component = shallow(React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue, inlined: true }));
67
- expect(component.find(".".concat(COMMENTS_CONTAINER_VISIBILITY_AREA)).find(CommentsContainer).length).toBe(0);
68
- expect(component.find(CommentsContainer).length).toBe(0);
109
+ setUp({ attributeType: attributeType, attributeValue: attributeValue, inlined: true });
110
+ expect(screen.queryByTestId('comments-container-visibility-area')).not.toBeInTheDocument();
69
111
  });
70
112
  it('should provide history className', function () {
71
113
  var attrType = { type: 'String', name: 'Name', uri: 'testAttributeUri' };
72
114
  var attributeValue = { value: '123', uri: 'testAttributeUri' };
73
- var component = mount(React.createElement(HistoryDiffContext.Provider, { value: historyDiff },
74
- React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue })));
75
- expect(component.find('.insertAttribute')).toHaveLength(1);
76
- });
77
- it('should render PivotingTooltip with history', function () {
78
- var attrType = { type: 'String', name: 'Name', uri: 'testAttributeUri' };
79
- var attributeValue = { value: '123', uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh' };
80
- var component = mount(React.createElement(HistoryDiffContext.Provider, { value: historyDiff },
81
- React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue })));
82
- expect(component.find(PivotingTooltip)).toHaveLength(1);
115
+ var historyDiff = {
116
+ appearance: { testAttributeUri: 'INSERT_ATTRIBUTE' },
117
+ attributes: {},
118
+ roles: [],
119
+ tags: []
120
+ };
121
+ setUp({ attributeType: attrType, attributeValue: attributeValue }, { historyDiff: historyDiff });
122
+ expect(screen.getByTestId('reltio-attribute-value')).toHaveClass('insertAttribute');
83
123
  });
124
+ it('should render PivotingTooltip with history', function () { return __awaiter(void 0, void 0, void 0, function () {
125
+ var attrType, attributeValue, historyDiff, pivotingAttribute;
126
+ return __generator(this, function (_a) {
127
+ attrType = { type: 'String', name: 'Name', uri: 'testAttributeUri' };
128
+ attributeValue = { value: '123', uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh' };
129
+ historyDiff = {
130
+ appearance: { testAttributeUri: 'INSERT_ATTRIBUTE' },
131
+ attributes: {},
132
+ roles: [],
133
+ tags: []
134
+ };
135
+ pivotingAttribute = [{ uri: 'testAttributeUri' }];
136
+ setUp({ attributeType: attrType, attributeValue: attributeValue }, { historyDiff: historyDiff, pivotingAttribute: pivotingAttribute });
137
+ expect(screen.getByTestId('SvgPivotingIcon')).toBeInTheDocument();
138
+ expect(screen.getByRole('link')).toHaveTextContent('123');
139
+ return [2 /*return*/];
140
+ });
141
+ }); });
84
142
  it('should render PivotingTooltip without history', function () {
85
- var attrType = { type: 'String', name: 'Name', uri: 'testAttributeUri' };
143
+ var attributeType = { type: 'String', name: 'Name', uri: 'testAttributeUri' };
86
144
  var attributeValue = { value: '123', uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh' };
87
- var component = mount(React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue }));
88
- expect(component.find(PivotingTooltip)).toHaveLength(1);
145
+ var pivotingAttribute = [{ uri: 'testAttributeUri' }];
146
+ setUp({ attributeType: attributeType, attributeValue: attributeValue }, { historyDiff: {}, pivotingAttribute: pivotingAttribute });
147
+ expect(screen.getByTestId('SvgPivotingIcon')).toBeInTheDocument();
148
+ expect(screen.getByRole('link')).toHaveTextContent('123');
89
149
  });
90
- it('should set correct props for CommentsContainer component if we have entity attribute', function () {
150
+ it('should render comments correctly for entity type', function () {
151
+ var attributeType = { type: 'String', name: 'Name', uri: 'uri1' };
152
+ var attributeValue = { value: '123', uri: 'entities/uri1/attributes/ABCD' };
153
+ var commentsMap = {
154
+ 'entities/uri1/attributes/ABCD': [{ commentId: 'commentId', status: 'open', replies: 0 }]
155
+ };
156
+ setUp({ attributeType: attributeType, attributeValue: attributeValue }, { collaboration: __assign(__assign({}, defaultCollaborationContextValue), { commentsMap: commentsMap }) });
157
+ expect(screen.getByTestId('comments-container-visibility-area')).toHaveClass(COMMENTS_CONTAINER_VISIBILITY_AREA);
158
+ expect(screen.getByText('123')).toBeInTheDocument();
159
+ expect(screen.getByTestId('comments-container')).toBeInTheDocument();
160
+ expect(screen.getByTestId('SvgAddComment')).toBeInTheDocument();
161
+ expect(screen.getByTestId('reltio-comment-button')).toBeInTheDocument();
162
+ });
163
+ it('should render comments correctly for relation type', function () {
91
164
  var attributeType = {
92
165
  uri: 'configuration/relationTypes/HCPtoHCP/attributes/AffiliationStatus',
93
166
  type: 'String',
@@ -100,49 +173,51 @@ describe('SimpleAttribute tests', function () {
100
173
  value: 'Active',
101
174
  ov: true
102
175
  };
103
- var component = shallow(React.createElement(SimpleAttribute, { attributeType: attributeType, attributeValue: attributeValue }));
104
- var commentsContainer = component.find(CommentsContainer);
105
- expect(commentsContainer.prop('relatedObjectUris')).toEqual(['relations/12rMNliU']);
106
- expect(commentsContainer.prop('objectType')).toBe(CollaborationObjectTypes.RELATION_ATTRIBUTE);
107
- component.setProps({
108
- attributeValue: __assign(__assign({}, attributeValue), { uri: 'entities/sIeHttl/attributes/Reference/r123/Simple/u123' })
109
- });
110
- commentsContainer = component.find(CommentsContainer);
111
- expect(commentsContainer.prop('relatedObjectUris')).toEqual(['entities/sIeHttl']);
112
- expect(commentsContainer.prop('objectType')).toBe(CollaborationObjectTypes.ENTITY_ATTRIBUTE);
176
+ var commentsMap = {
177
+ 'relations/12rMNliU/attributes/AffiliationSubType/3e6txxgYJ': [
178
+ { commentId: 'commentId', status: 'open', replies: 0 }
179
+ ]
180
+ };
181
+ setUp({ attributeType: attributeType, attributeValue: attributeValue }, { collaboration: __assign(__assign({}, defaultCollaborationContextValue), { commentsMap: commentsMap }) });
182
+ expect(screen.getByTestId('comments-container-visibility-area')).toHaveClass(COMMENTS_CONTAINER_VISIBILITY_AREA);
183
+ expect(screen.getByTestId('comments-container')).toBeInTheDocument();
184
+ expect(screen.getByTestId('SvgAddComment')).toBeInTheDocument();
185
+ expect(screen.getByTestId('reltio-comment-button')).toBeInTheDocument();
113
186
  });
114
187
  it('should render highlighted label', function () {
115
188
  var attributeType = { type: 'String', name: 'Name', uri: 'testAttributeUri', label: 'Affiliation Status' };
116
189
  var attributeValue = { value: '123', uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh' };
117
- var highlightedValuesContextValues = {
190
+ var highlightedValues = {
118
191
  highlightedValuesUris: [attributeValue.uri],
119
192
  highlightedClassName: 'hlClassName'
120
193
  };
121
- var component = mount(React.createElement(HighlightedValuesContext.Provider, { value: highlightedValuesContextValues },
122
- React.createElement(SimpleAttribute, { attributeType: attributeType, attributeValue: attributeValue })));
123
- expect(component.find('div.root').hasClass('hlClassName')).toBeTruthy();
194
+ setUp({ attributeType: attributeType, attributeValue: attributeValue }, { highlightedValues: highlightedValues });
195
+ var container = screen.getByTestId('comments-container-visibility-area');
196
+ expect(container).toHaveClass('hlClassName');
197
+ expect(container).toHaveTextContent('123');
124
198
  });
125
199
  it('should render label without highlights', function () {
126
200
  var attributeType = { type: 'String', name: 'Name', uri: 'testAttributeUri', label: 'Affiliation Status' };
127
201
  var attributeValue = { value: '123', uri: 'entities/16U21B8f/attributes/Name/2sAfjGOIh' };
128
- var highlightedValuesContextValues = {
202
+ var highlightedValues = {
129
203
  highlightedValuesUris: ['testAttributeUr'],
130
204
  highlightedClassName: 'hlClassName'
131
205
  };
132
- var component = mount(React.createElement(HighlightedValuesContext.Provider, { value: highlightedValuesContextValues },
133
- React.createElement(SimpleAttribute, { attributeType: attributeType, attributeValue: attributeValue })));
134
- expect(component.hasClass('hlClassName')).toBeFalsy();
206
+ setUp({ attributeType: attributeType, attributeValue: attributeValue }, { highlightedValues: highlightedValues });
207
+ var container = screen.getByTestId('comments-container-visibility-area');
208
+ expect(container).not.toHaveClass('hlClassName');
209
+ expect(container).toHaveTextContent('123');
135
210
  });
136
211
  it('should add ovFalse style if inlined is true', function () {
137
- var attrType = { type: 'String', name: 'Name', uri: 'uri1' };
212
+ var attributeType = { type: 'String', name: 'Name', uri: 'uri1' };
138
213
  var attributeValue = { value: '123', uri: 'uri1', ov: false };
139
- var component = shallow(React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue, inlined: true }));
140
- expect(component.find('span').hasClass('ovFalse')).toBe(true);
214
+ setUp({ attributeType: attributeType, attributeValue: attributeValue, inlined: true });
215
+ expect(screen.getByTestId('reltio-attribute-value')).toHaveClass('ovFalse');
141
216
  });
142
217
  it('should add ovFalse style if inlined is false', function () {
143
- var attrType = { type: 'String', name: 'Name', uri: 'uri1' };
218
+ var attributeType = { type: 'String', name: 'Name', uri: 'uri1' };
144
219
  var attributeValue = { value: '123', uri: 'uri1', ov: false };
145
- var component = shallow(React.createElement(SimpleAttribute, { attributeType: attrType, attributeValue: attributeValue }));
146
- expect(component.find('span').hasClass('ovFalse')).toBe(true);
220
+ setUp({ attributeType: attributeType, attributeValue: attributeValue, inlined: false });
221
+ expect(screen.getByTestId('reltio-attribute-value')).toHaveClass('ovFalse');
147
222
  });
148
223
  });