@reltio/components 1.4.1997 → 1.4.1998

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 (139) hide show
  1. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
  2. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
  3. package/cjs/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +267 -0
  4. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
  5. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
  6. package/cjs/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
  7. package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
  8. package/cjs/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
  9. package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
  10. package/cjs/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
  11. package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
  12. package/cjs/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
  13. package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
  14. package/cjs/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
  15. package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
  16. package/cjs/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
  17. package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
  18. package/cjs/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
  19. package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
  20. package/cjs/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
  21. package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
  22. package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
  23. package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
  24. package/cjs/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
  25. package/cjs/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
  26. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
  27. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +784 -0
  28. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
  29. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
  30. package/cjs/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +102 -79
  31. package/cjs/features/activity-log/EntityObject/EntityObject.test.js +35 -26
  32. package/cjs/features/activity-log/Field/Field.d.ts +2 -3
  33. package/cjs/features/activity-log/Field/Field.js +24 -2
  34. package/cjs/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
  35. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
  36. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.test.js +207 -0
  37. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
  38. package/cjs/features/activity-log/RelationObject/RelationObject.test.js +46 -29
  39. package/cjs/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
  40. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.d.ts +1 -1
  41. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.js +1 -1
  42. package/esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.js +262 -0
  43. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.d.ts +1 -2
  44. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.js +1 -1
  45. package/esm/features/activity-log/ActivitiesFactory/components/CommentActivity/CommentActivity.test.js +5 -23
  46. package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.js +2 -2
  47. package/esm/features/activity-log/ActivitiesFactory/components/GroupActivity/GroupActivity.test.js +3 -23
  48. package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.js +2 -2
  49. package/esm/features/activity-log/ActivitiesFactory/components/MergeActivity/MergeActivity.test.js +81 -102
  50. package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.d.ts +2 -2
  51. package/esm/features/activity-log/ActivitiesFactory/components/ObjectLabel/ObjectLabel.js +24 -2
  52. package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.js +1 -1
  53. package/esm/features/activity-log/ActivitiesFactory/components/PotentialMatchActivity/PotentialMatchActivity.test.js +69 -48
  54. package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.js +2 -2
  55. package/esm/features/activity-log/ActivitiesFactory/components/ProfileActivity/ProfileActivity.test.js +123 -107
  56. package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.js +2 -2
  57. package/esm/features/activity-log/ActivitiesFactory/components/RelationActivity/RelationActivity.test.js +128 -115
  58. package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.js +1 -1
  59. package/esm/features/activity-log/ActivitiesFactory/components/SearchActivity/SearchActivity.test.js +160 -183
  60. package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.js +2 -2
  61. package/esm/features/activity-log/ActivitiesFactory/components/SimpleActivity/SimpleActivity.test.js +44 -28
  62. package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.js +4 -5
  63. package/esm/features/activity-log/ActivitiesFactory/components/SynchronizationIssuesActivity/SynchronizationIssuesActivity.test.js +54 -47
  64. package/esm/features/activity-log/ActivityLog/ActivityLog.test.js +83 -22
  65. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.js +1 -1
  66. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.js +779 -0
  67. package/esm/features/activity-log/ActivityTitle/ActivityTitle.d.ts +2 -3
  68. package/esm/features/activity-log/ActivityTitle/ActivityTitle.js +24 -2
  69. package/esm/features/activity-log/CollapsibleActivityRecords/CollapsibleActivityRecords.test.js +104 -58
  70. package/esm/features/activity-log/EntityObject/EntityObject.test.js +35 -26
  71. package/esm/features/activity-log/Field/Field.d.ts +2 -3
  72. package/esm/features/activity-log/Field/Field.js +24 -2
  73. package/esm/features/activity-log/PotentialMatchRecord/PotentialMatchRecord.test.js +160 -34
  74. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.js +1 -1
  75. package/esm/features/activity-log/RecordUpdates/RecordUpdates.test.js +202 -0
  76. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.js +1 -1
  77. package/esm/features/activity-log/RelationObject/RelationObject.test.js +46 -29
  78. package/esm/features/activity-log/RelationRecord/RelationRecord.test.js +88 -68
  79. package/package.json +1 -1
  80. package/cjs/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -142
  81. package/cjs/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -131
  82. package/cjs/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -252
  83. package/cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -158
  84. package/cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -135
  85. package/cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -65
  86. package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
  87. package/cjs/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -119
  88. package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
  89. package/cjs/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -75
  90. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
  91. package/cjs/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -140
  92. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
  93. package/cjs/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -41
  94. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
  95. package/cjs/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -87
  96. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
  97. package/cjs/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -19
  98. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
  99. package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -179
  100. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
  101. package/cjs/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -150
  102. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
  103. package/cjs/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -124
  104. package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.d.ts +0 -1
  105. package/esm/features/activity-log/ActivityExportButton/ActivityExportButton.specs.js +0 -137
  106. package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.d.ts +0 -1
  107. package/esm/features/activity-log/ActivityFilterButton/ActivityFilterButton.specs.js +0 -126
  108. package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.d.ts +0 -1
  109. package/esm/features/activity-log/ActivityFilterEditor/ActivityFilterEditor.specs.js +0 -247
  110. package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts +0 -1
  111. package/esm/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.js +0 -153
  112. package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts +0 -1
  113. package/esm/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.js +0 -130
  114. package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts +0 -1
  115. package/esm/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.js +0 -60
  116. package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.d.ts +0 -1
  117. package/esm/features/activity-log/ActivityFilterEditor/components/SourceSelector/SourceSelector.specs.js +0 -114
  118. package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.d.ts +0 -25
  119. package/esm/features/activity-log/ActivityFilterEditor/editor.test-data.js +0 -72
  120. package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.d.ts +0 -1
  121. package/esm/features/activity-log/ActivityLog/components/ActivityItem/ActivityItem.test.js +0 -135
  122. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.d.ts +0 -1
  123. package/esm/features/activity-log/ActivityLog/components/GroupItem/GroupItem.test.js +0 -36
  124. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.d.ts +0 -1
  125. package/esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.specs.js +0 -82
  126. package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.d.ts +0 -1
  127. package/esm/features/activity-log/ActivityTitle/ActivityTitle.test.js +0 -14
  128. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.d.ts +0 -1
  129. package/esm/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/PotentialMatchField.test.js +0 -151
  130. package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.d.ts +0 -1
  131. package/esm/features/activity-log/RecordUpdates/RecordUpdates.specs.js +0 -122
  132. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.d.ts +0 -1
  133. package/esm/features/activity-log/RecordUpdates/components/DeltaField/DeltaField.test.js +0 -119
  134. /package/cjs/features/activity-log/{ActivityExportButton/ActivityExportButton.specs.d.ts → ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
  135. /package/cjs/features/activity-log/{ActivityFilterButton/ActivityFilterButton.specs.d.ts → ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
  136. /package/cjs/features/activity-log/{ActivityFilterEditor/ActivityFilterEditor.specs.d.ts → RecordUpdates/RecordUpdates.test.d.ts} +0 -0
  137. /package/{cjs/features/activity-log/ActivityFilterEditor/components/ActivitySelector/ActivitySelector.specs.d.ts → esm/features/activity-log/ActivitiesFactory/ActivitiesFactory.test.d.ts} +0 -0
  138. /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityChangedSelectors/EntityChangedSelectors.specs.d.ts → esm/features/activity-log/ActivityLogFilter/ActivityLogFilter.test.d.ts} +0 -0
  139. /package/{cjs/features/activity-log/ActivityFilterEditor/components/EntityTypesSelector/EntityTypesSelector.specs.d.ts → esm/features/activity-log/RecordUpdates/RecordUpdates.test.d.ts} +0 -0
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ActivityTypes } from '../types';
3
- type Props = {
3
+ type Props = Omit<React.ComponentPropsWithoutRef<'div'>, 'className'> & {
4
4
  type: ActivityTypes;
5
- children?: React.ReactNode;
6
5
  };
7
- export declare const ActivityTitle: ({ type, children }: Props) => React.JSX.Element;
6
+ export declare const ActivityTitle: ({ type, children, ...restProps }: Props) => React.JSX.Element;
8
7
  export {};
@@ -1,4 +1,26 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
2
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
26
  };
@@ -8,9 +30,9 @@ var react_1 = __importDefault(require("react"));
8
30
  var activities_1 = require("../utils/activities");
9
31
  var styles_1 = require("./styles");
10
32
  var ActivityTitle = function (_a) {
11
- var type = _a.type, children = _a.children;
33
+ var type = _a.type, children = _a.children, restProps = __rest(_a, ["type", "children"]);
12
34
  var styles = (0, styles_1.useStyles)();
13
- return (react_1.default.createElement("span", { className: styles.activityTitle },
35
+ return (react_1.default.createElement("span", __assign({ className: styles.activityTitle }, restProps),
14
36
  react_1.default.createElement("span", { className: styles.activityType }, (0, activities_1.getActivityLabel)(type)),
15
37
  children));
16
38
  };
@@ -1,94 +1,117 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ 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);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ 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;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7
47
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
48
  };
25
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
51
  };
28
52
  Object.defineProperty(exports, "__esModule", { value: true });
29
53
  var react_1 = __importDefault(require("react"));
30
- var test_utils_1 = require("react-dom/test-utils");
31
- var enzyme_1 = require("enzyme");
32
- var collapsibleItemsContext = __importStar(require("../contexts/CollapsibleItemsContext"));
54
+ var react_2 = require("@testing-library/react");
55
+ var user_event_1 = __importDefault(require("@testing-library/user-event"));
56
+ var CollapsibleItemsContext_1 = require("../contexts/CollapsibleItemsContext");
33
57
  var CollapsibleActivityRecords_1 = require("./CollapsibleActivityRecords");
34
- var MoreItemsLink_1 = require("../MoreItemsLink");
35
- var Component = function () { return react_1.default.createElement(react_1.default.Fragment, null); };
36
- describe('CollapsibleActivityRecords tests', function () {
37
- var onExpand = jest.fn();
38
- var useCollapsibleItems = jest.spyOn(collapsibleItemsContext, 'useCollapsibleItems');
39
- beforeEach(function () {
40
- useCollapsibleItems.mockImplementation(function () { return ({ itemsToShow: [], onExpand: onExpand, collapsedItemsCount: 0 }); });
41
- });
58
+ var defaultItems = [
59
+ { id: 'item-1', timestamp: 1234567890 },
60
+ { id: 'item-2', timestamp: 1234567890 },
61
+ { id: 'item-3', timestamp: 1234567890 },
62
+ { id: 'item-4', timestamp: 1234567890 },
63
+ { id: 'item-5', timestamp: 1234567890 }
64
+ ];
65
+ var RecordComponent = function (_a) {
66
+ var item = _a.item;
67
+ return react_1.default.createElement("div", { "data-reltio-id": "activity-record" }, item.id);
68
+ };
69
+ var defaultProps = { activityUri: 'activity-uri', items: defaultItems, RecordComponent: RecordComponent };
70
+ var setUp = function (props) {
71
+ if (props === void 0) { props = defaultProps; }
72
+ var user = user_event_1.default.setup();
73
+ var Providers = function (_a) {
74
+ var children = _a.children;
75
+ return (react_1.default.createElement(CollapsibleItemsContext_1.CollapsibleItemsProvider, null, children));
76
+ };
77
+ return __assign(__assign({}, (0, react_2.render)(react_1.default.createElement(CollapsibleActivityRecords_1.CollapsibleActivityRecords, __assign({}, props)), { wrapper: Providers })), { user: user });
78
+ };
79
+ describe('Collapsible activity records tests', function () {
42
80
  it('should not render anything if items empty', function () {
43
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(CollapsibleActivityRecords_1.CollapsibleActivityRecords, { RecordComponent: Component, items: [], activityUri: '11' }));
44
- expect(component.find(Component)).toHaveLength(0);
45
- expect(component.find(MoreItemsLink_1.MoreItemsLink)).toHaveLength(0);
46
- });
47
- it('should render 3 items without Link', function () {
48
- var items = [
49
- { id: 'string1', timestamp: 123 },
50
- { id: 'string2', timestamp: 123 },
51
- { id: 'string3', timestamp: 123 }
52
- ];
53
- useCollapsibleItems.mockImplementation(function () { return ({ itemsToShow: items, onExpand: onExpand, collapsedItemsCount: 0 }); });
54
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(CollapsibleActivityRecords_1.CollapsibleActivityRecords, { RecordComponent: Component, items: items, activityUri: '11' }));
55
- expect(component.find(Component)).toHaveLength(3);
56
- expect(component.find(MoreItemsLink_1.MoreItemsLink)).toHaveLength(0);
81
+ var container = setUp(__assign(__assign({}, defaultProps), { items: [] })).container;
82
+ expect(container).toBeEmptyDOMElement();
57
83
  });
58
- it('should render 3 items with Link and call onExpand on click', function () {
59
- var items = [
60
- { id: 'string1', timestamp: 123 },
61
- { id: 'string2', timestamp: 123 },
62
- { id: 'string3', timestamp: 123 },
63
- { id: 'string4', timestamp: 123 },
64
- { id: 'string5', timestamp: 123 }
65
- ];
66
- useCollapsibleItems.mockImplementation(function () { return ({
67
- itemsToShow: items.slice(0, 3),
68
- onExpand: onExpand,
69
- collapsedItemsCount: 2
70
- }); });
71
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(CollapsibleActivityRecords_1.CollapsibleActivityRecords, { RecordComponent: Component, items: items, activityUri: '11' }));
72
- expect(component.find(Component)).toHaveLength(3);
73
- var moreItemsLink = component.find(MoreItemsLink_1.MoreItemsLink);
74
- expect(moreItemsLink.prop('itemsCount')).toBe(2);
75
- expect(moreItemsLink.prop('itemsLabel')).toBe('records');
76
- (0, test_utils_1.act)(function () {
77
- moreItemsLink.prop('onClick')();
84
+ it('should render and expand items correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
85
+ var user, activityRecords;
86
+ return __generator(this, function (_a) {
87
+ switch (_a.label) {
88
+ case 0:
89
+ user = setUp().user;
90
+ activityRecords = react_2.screen.getAllByTestId('activity-record');
91
+ expect(activityRecords).toHaveLength(3);
92
+ expect(activityRecords[0]).toHaveTextContent('item-1');
93
+ expect(activityRecords[1]).toHaveTextContent('item-2');
94
+ expect(activityRecords[2]).toHaveTextContent('item-3');
95
+ return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: '2 more records' }))];
96
+ case 1:
97
+ _a.sent();
98
+ activityRecords = react_2.screen.getAllByTestId('activity-record');
99
+ expect(activityRecords).toHaveLength(5);
100
+ expect(activityRecords[3]).toHaveTextContent('item-4');
101
+ expect(activityRecords[4]).toHaveTextContent('item-5');
102
+ expect(react_2.screen.queryByRole('button')).not.toBeInTheDocument();
103
+ return [2 /*return*/];
104
+ }
78
105
  });
79
- expect(onExpand).toHaveBeenCalled();
106
+ }); });
107
+ it('should not render more items link if items count is 3 or less', function () {
108
+ setUp(__assign(__assign({}, defaultProps), { items: defaultItems.slice(0, 3) }));
109
+ expect(react_2.screen.getAllByTestId('activity-record')).toHaveLength(3);
110
+ expect(react_2.screen.queryByRole('button')).not.toBeInTheDocument();
80
111
  });
81
- it('should render 5 items without Link', function () {
82
- var items = [
83
- { id: 'string1', timestamp: 123 },
84
- { id: 'string2', timestamp: 123 },
85
- { id: 'string3', timestamp: 123 },
86
- { id: 'string4', timestamp: 123 },
87
- { id: 'string5', timestamp: 123 }
88
- ];
89
- useCollapsibleItems.mockImplementation(function () { return ({ itemsToShow: items, onExpand: onExpand, collapsedItemsCount: 0 }); });
90
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(CollapsibleActivityRecords_1.CollapsibleActivityRecords, { RecordComponent: Component, items: items, activityUri: '11' }));
91
- expect(component.find(Component)).toHaveLength(5);
92
- expect(component.find(MoreItemsLink_1.MoreItemsLink)).toHaveLength(0);
112
+ it('should render more items link correctly if items count is 4', function () {
113
+ setUp(__assign(__assign({}, defaultProps), { items: defaultItems.slice(0, 4) }));
114
+ expect(react_2.screen.getAllByTestId('activity-record')).toHaveLength(3);
115
+ react_2.screen.getByRole('button', { name: '1 more record' });
93
116
  });
94
117
  });
@@ -15,32 +15,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var react_1 = __importDefault(require("react"));
18
- var enzyme_1 = require("enzyme");
18
+ var react_2 = require("@testing-library/react");
19
+ var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
20
+ var types_1 = require("../types");
19
21
  var EntityObject_1 = require("./EntityObject");
20
- describe('EntityObject tests', function () {
21
- it('should render correctly', function () {
22
- var item = {
23
- id: '3vJgNLSN',
24
- user: 'egorshkov',
25
- method: 'POST',
26
- url: '/reltio/api/alenat/entities/sOoSQYm/_update',
27
- clientType: 'Reltio UI',
28
- timestamp: 1621847085259,
29
- objectUri: 'relations/edEnRRW',
30
- objectType: 'configuration/relationTypes/HasAddress',
31
- objectLabel: '- cBtCASwtAeEbTxe Agacati',
32
- data: {
33
- type: 'ENTITY_CHANGED'
34
- },
35
- eventId: '1621847085259_00qpSyx'
36
- };
37
- var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(EntityObject_1.EntityObject, { item: item }));
38
- var objectUri = item.objectUri, objectLabel = item.objectLabel;
39
- var link = wrapper.find('EntityUriLink');
40
- expect(link.length).toBe(1);
41
- expect(link.prop('value')).toBe(objectUri);
42
- expect(link.text()).toBe(objectLabel);
43
- wrapper.setProps({ item: __assign(__assign({}, item), { data: { type: 'ENTITY_REMOVED' } }) });
44
- expect(wrapper.find('.removed').length).toBe(1);
22
+ var defaultItem = {
23
+ id: '3vJgNLSN',
24
+ timestamp: 1621847085259,
25
+ objectUri: 'relations/edEnRRW',
26
+ objectLabel: 'object label',
27
+ data: { type: types_1.ActivityTypes.ENTITY_CHANGED }
28
+ };
29
+ var defaultProps = {
30
+ item: defaultItem
31
+ };
32
+ var defaultMdmValues = {
33
+ uiPath: 'https://reltio.com/nui'
34
+ };
35
+ var setUp = function (_a) {
36
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
37
+ var Providers = function (_a) {
38
+ var children = _a.children;
39
+ return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues }, children));
40
+ };
41
+ return (0, react_2.render)(react_1.default.createElement(EntityObject_1.EntityObject, __assign({}, props)), { wrapper: Providers });
42
+ };
43
+ describe('Entity object tests', function () {
44
+ it('should render entity object correctly', function () {
45
+ setUp();
46
+ var link = react_2.screen.getByText('object label');
47
+ expect(link).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~relations/edEnRRW');
48
+ expect(link).not.toHaveClass('removed');
49
+ });
50
+ it('should render entity object with ENTITY_REMOVED type correctly', function () {
51
+ var props = __assign(__assign({}, defaultProps), { item: __assign(__assign({}, defaultItem), { data: { type: types_1.ActivityTypes.ENTITY_REMOVED } }) });
52
+ setUp({ props: props });
53
+ expect(react_2.screen.getByText('object label')).toHaveClass('removed');
45
54
  });
46
55
  });
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- type Props = {
2
+ type Props = Omit<React.ComponentPropsWithoutRef<'div'>, 'className'> & {
3
3
  fieldName: string;
4
- children: React.ReactNode;
5
4
  };
6
- export declare const Field: ({ fieldName, children }: Props) => React.JSX.Element;
5
+ export declare const Field: ({ fieldName, children, ...restProps }: Props) => React.JSX.Element;
7
6
  export {};
@@ -1,4 +1,26 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
2
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
26
  };
@@ -7,9 +29,9 @@ exports.Field = void 0;
7
29
  var react_1 = __importDefault(require("react"));
8
30
  var styles_1 = require("./styles");
9
31
  var Field = function (_a) {
10
- var fieldName = _a.fieldName, children = _a.children;
32
+ var fieldName = _a.fieldName, children = _a.children, restProps = __rest(_a, ["fieldName", "children"]);
11
33
  var styles = (0, styles_1.useStyles)();
12
- return (react_1.default.createElement("div", { className: styles.field },
34
+ return (react_1.default.createElement("div", __assign({ className: styles.field }, restProps),
13
35
  react_1.default.createElement("span", { className: styles.fieldName },
14
36
  fieldName,
15
37
  ":"),
@@ -10,48 +10,174 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ 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);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ 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;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
13
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
51
  };
16
52
  Object.defineProperty(exports, "__esModule", { value: true });
17
53
  var react_1 = __importDefault(require("react"));
18
- var enzyme_1 = require("enzyme");
54
+ var react_2 = require("@testing-library/react");
55
+ var user_event_1 = __importDefault(require("@testing-library/user-event"));
56
+ var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
57
+ var CollapsibleItemsContext_1 = require("../contexts/CollapsibleItemsContext");
58
+ var types_1 = require("../types");
19
59
  var PotentialMatchRecord_1 = require("./PotentialMatchRecord");
20
- describe('PotentialMatchRecord tests', function () {
21
- var item = {
22
- id: '3LfWvAlI',
23
- user: 'IncrementalMatchThread',
24
- clientType: 'API',
25
- timestamp: 1621847092199,
26
- objectUri: 'entities/11EunumT',
27
- objectType: 'configuration/entityTypes/HCP',
28
- objectLabel: '- cBtCASwtAeEbTxe Agacati',
29
- data: {
30
- potentialMatches: 'entities/sOoSQYm,entities/sOoSQYq,entities/sOoSQYw',
31
- type: 'POTENTIAL_MATCHES_FOUND',
32
- 'entities/sOoSQYm': '- cBtCASwtAeEbTxe Agacati',
33
- 'entities/sOoSQYq': '- cBtCASwtAeEbTxe Test',
34
- 'entities/sOoSQYw': '123'
35
- },
36
- eventId: '1621847092199_00Nr58d'
60
+ var defaultItem = {
61
+ id: '3LfWvAlI',
62
+ timestamp: 1621847092199,
63
+ objectUri: 'entities/11EunumT',
64
+ objectType: 'configuration/entityTypes/HCP',
65
+ objectLabel: 'record label',
66
+ data: {
67
+ potentialMatches: 'entities/sOoSQYm,entities/sOoSQYq,entities/sOoSQYw,entities/p3Js13Nm,entities/zIlemSd09',
68
+ type: types_1.ActivityTypes.POTENTIAL_MATCHES_FOUND,
69
+ 'entities/sOoSQYm': 'entity label 1',
70
+ 'entities/sOoSQYq': 'entity label 2',
71
+ 'entities/sOoSQYw': 'entity label 3',
72
+ 'entities/p3Js13Nm': 'entity label 4',
73
+ 'entities/zIlemSd09': 'entity label 5'
74
+ }
75
+ };
76
+ var defaultProps = {
77
+ item: defaultItem
78
+ };
79
+ var defaultMdmValues = {
80
+ uiPath: 'https://reltio.com/nui'
81
+ };
82
+ var setUp = function (_a) {
83
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
84
+ var user = user_event_1.default.setup();
85
+ var Providers = function (_a) {
86
+ var children = _a.children;
87
+ return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues },
88
+ react_1.default.createElement(CollapsibleItemsContext_1.CollapsibleItemsProvider, null, children)));
37
89
  };
38
- it('should render correctly', function () {
39
- var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(PotentialMatchRecord_1.PotentialMatchRecord, { item: item }));
40
- expect(wrapper.find('EntityObject').length).toBe(1);
41
- expect(wrapper.find('PotentialMatchField').length).toBe(1);
90
+ return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(PotentialMatchRecord_1.PotentialMatchRecord, __assign({}, props)), { wrapper: Providers }));
91
+ };
92
+ describe('Potential match record tests', function () {
93
+ it('should render nothing if there are not potentialMatches or newUri fields', function () {
94
+ var props = __assign(__assign({}, defaultProps), { item: __assign(__assign({}, defaultItem), { data: { type: types_1.ActivityTypes.POTENTIAL_MATCHES_FOUND } }) });
95
+ var container = setUp({ props: props }).container;
96
+ expect(container).toBeEmptyDOMElement();
42
97
  });
43
- it('should render newUri correctly', function () {
44
- var newUriItem = __assign(__assign({}, item), { data: {
45
- 'entities/2eIQy30G': 'HCP DT 2,',
46
- newUri: 'entities/2eIQy30G',
47
- type: 'ENTITIES_SPLITTED'
48
- } });
49
- var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(PotentialMatchRecord_1.PotentialMatchRecord, { item: newUriItem }));
50
- expect(wrapper.find('EntityObject').length).toBe(1);
51
- expect(wrapper.find('PotentialMatchField').length).toBe(1);
98
+ it('should render record label correctly', function () {
99
+ setUp();
100
+ expect(react_2.screen.getByText('record label')).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/11EunumT');
52
101
  });
53
- it('should not render if there are not potentialMatches/newUri', function () {
54
- var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(PotentialMatchRecord_1.PotentialMatchRecord, { item: __assign(__assign({}, item), { data: { type: 'POTENTIAL_MATCHES_FOUND' } }) }));
55
- expect(wrapper.isEmptyRender()).toBe(true);
102
+ it('should render matches correctly for potentialMatches field', function () { return __awaiter(void 0, void 0, void 0, function () {
103
+ var user, _a, links, moreItemsLink;
104
+ var _b;
105
+ return __generator(this, function (_c) {
106
+ switch (_c.label) {
107
+ case 0:
108
+ user = setUp().user;
109
+ expect(react_2.screen.getByTestId('potential-matches-field')).toHaveTextContent('Matches found:entity label 1, entity label 2, entity label 3 and 2 more matches');
110
+ _a = react_2.screen.getAllByRole('link'), links = _a.slice(1);
111
+ expect(links).toHaveLength(3);
112
+ expect(links[0]).toHaveTextContent('entity label 1');
113
+ expect(links[0]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/sOoSQYm');
114
+ expect(links[1]).toHaveTextContent('entity label 2');
115
+ expect(links[1]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/sOoSQYq');
116
+ expect(links[2]).toHaveTextContent('entity label 3');
117
+ expect(links[2]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/sOoSQYw');
118
+ moreItemsLink = react_2.screen.getByRole('button', { name: '2 more matches' });
119
+ return [4 /*yield*/, user.click(moreItemsLink)];
120
+ case 1:
121
+ _c.sent();
122
+ expect(react_2.screen.getByTestId('potential-matches-field')).toHaveTextContent('Matches found:entity label 1, entity label 2, entity label 3, entity label 4, entity label 5');
123
+ _b = react_2.screen.getAllByRole('link'), links = _b.slice(1);
124
+ expect(links).toHaveLength(5);
125
+ expect(links[3]).toHaveTextContent('entity label 4');
126
+ expect(links[3]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/p3Js13Nm');
127
+ expect(links[4]).toHaveTextContent('entity label 5');
128
+ expect(links[4]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/zIlemSd09');
129
+ expect(moreItemsLink).not.toBeInTheDocument();
130
+ return [2 /*return*/];
131
+ }
132
+ });
133
+ }); });
134
+ it('should render matches correctly for newUri field', function () { return __awaiter(void 0, void 0, void 0, function () {
135
+ var props, user, _a, links, moreItemsLink;
136
+ var _b;
137
+ return __generator(this, function (_c) {
138
+ switch (_c.label) {
139
+ case 0:
140
+ props = __assign(__assign({}, defaultProps), { item: __assign(__assign({}, defaultItem), { data: {
141
+ type: types_1.ActivityTypes.ENTITIES_SPLITTED,
142
+ newUri: 'entities/sOoSQYm,entities/sOoSQYq,entities/sOoSQYw,entities/p3Js13Nm',
143
+ 'entities/sOoSQYm': 'entity label 1',
144
+ 'entities/sOoSQYq': 'entity label 2',
145
+ 'entities/sOoSQYw': 'entity label 3',
146
+ 'entities/p3Js13Nm': 'entity label 4'
147
+ } }) });
148
+ user = setUp({ props: props }).user;
149
+ expect(react_2.screen.getByTestId('potential-matches-field')).toHaveTextContent('Un-merged with:entity label 1, entity label 2, entity label 3 and 1 more match');
150
+ _a = react_2.screen.getAllByRole('link'), links = _a.slice(1);
151
+ expect(links).toHaveLength(3);
152
+ expect(links[0]).toHaveTextContent('entity label 1');
153
+ expect(links[0]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/sOoSQYm');
154
+ expect(links[1]).toHaveTextContent('entity label 2');
155
+ expect(links[1]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/sOoSQYq');
156
+ expect(links[2]).toHaveTextContent('entity label 3');
157
+ expect(links[2]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/sOoSQYw');
158
+ moreItemsLink = react_2.screen.getByRole('button', { name: '1 more match' });
159
+ return [4 /*yield*/, user.click(moreItemsLink)];
160
+ case 1:
161
+ _c.sent();
162
+ expect(react_2.screen.getByTestId('potential-matches-field')).toHaveTextContent('Un-merged with:entity label 1, entity label 2, entity label 3, entity label 4');
163
+ _b = react_2.screen.getAllByRole('link'), links = _b.slice(1);
164
+ expect(links).toHaveLength(4);
165
+ expect(links[3]).toHaveTextContent('entity label 4');
166
+ expect(links[3]).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/p3Js13Nm');
167
+ expect(moreItemsLink).not.toBeInTheDocument();
168
+ return [2 /*return*/];
169
+ }
170
+ });
171
+ }); });
172
+ it('should not render more items link if items count is 3 or less', function () {
173
+ var props = __assign(__assign({}, defaultProps), { item: __assign(__assign({}, defaultItem), { data: {
174
+ potentialMatches: 'entities/sOoSQYm,entities/sOoSQYq,entities/sOoSQYw',
175
+ type: types_1.ActivityTypes.POTENTIAL_MATCHES_FOUND,
176
+ 'entities/sOoSQYm': 'entity label 1',
177
+ 'entities/sOoSQYq': 'entity label 2',
178
+ 'entities/sOoSQYw': 'entity label 3'
179
+ } }) });
180
+ setUp({ props: props });
181
+ expect(react_2.screen.queryByRole('button')).not.toBeInTheDocument();
56
182
  });
57
183
  });
@@ -22,7 +22,7 @@ var PotentialMatchField = function (_a) {
22
22
  items: matches.split(',')
23
23
  }), onExpand = _c.onExpand, collapsedItemsCount = _c.collapsedItemsCount, itemsToShow = _c.itemsToShow;
24
24
  var type = data === null || data === void 0 ? void 0 : data.type;
25
- return (react_1.default.createElement(Field_1.Field, { fieldName: (0, helpers_1.getFieldName)(type) },
25
+ return (react_1.default.createElement(Field_1.Field, { fieldName: (0, helpers_1.getFieldName)(type), "data-reltio-id": "potential-matches-field" },
26
26
  itemsToShow
27
27
  .map(function (url, index) { return (react_1.default.createElement(EntityUriLink_1.EntityUriLink, { key: index, value: url, className: styles.link }, (0, mdm_sdk_1.getLabel)(data[url]))); })
28
28
  .reduce(function (prev, curr) { return [prev, ', ', curr]; }),