@reltio/components 1.4.2069 → 1.4.2071

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 (159) hide show
  1. package/FacetViewHeader/FacetViewHeader.js +1 -1
  2. package/ImageAttributesLine/imageAttributeValues.test-data.js +8 -0
  3. package/ImageAttributesLine/index.d.ts +1 -1
  4. package/ImageAttributesLine/index.js +1 -1
  5. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +1 -1
  6. package/MergeButton/MergeButton.spec.js +55 -124
  7. package/MetadataTypesSelector/MetadataTypesSelector.js +1 -1
  8. package/MetadataTypesSelector/MetadataTypesSelector.test.js +193 -190
  9. package/MoreAttributesButton/MoreAttributesButton.test.js +173 -166
  10. package/MultiValueSelector/MultiValueSelector.test.js +78 -38
  11. package/MultipliableSelect/MultipliableSelect.test.js +111 -47
  12. package/NestedAttribute/NestedAttribute.test.js +121 -42
  13. package/NestedAttributeEditor/NestedAttributeEditor.test.js +95 -41
  14. package/NotMatchButton/NotMatchButton.spec.js +51 -100
  15. package/PieChart/PieChart.test.js +130 -114
  16. package/PinButton/PinButton.spec.js +89 -22
  17. package/PivotingTooltip/PivotingTooltip.test.js +338 -174
  18. package/PotentialMatchReviewCard/PotentialMatchReviewCard.spec.js +94 -29
  19. package/ProfileBand/ProfileBand.spec.js +60 -53
  20. package/ProfileCard/ProfileCard.test.js +109 -27
  21. package/ProfilesList/ProfilesList.d.ts +1 -3
  22. package/ProfilesList/ProfilesList.js +1 -1
  23. package/ProfilesList/ProfilesList.spec.js +226 -211
  24. package/QueryBuilderRow/QueryBuilderRow.spec.js +83 -90
  25. package/QueryBuilderRowsGroup/QueryBuilderRowsGroup.spec.js +195 -86
  26. package/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +73 -15
  27. package/ReactSelectMenuWithPopper/ReactSelectMenuWithPopper.test.js +71 -117
  28. package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +128 -61
  29. package/ReadOnlyAttributesFactory/components/ReadOnlyAttribute/ReadOnlyAttribute.test.js +179 -44
  30. package/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +254 -211
  31. package/ReadOnlyAttributesList/attributes.test-data.js +4 -4
  32. package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +75 -18
  33. package/ReadOnlyAttributesView/ReadOnlyAttributesView.test.js +187 -312
  34. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +210 -219
  35. package/ReadOnlyImageAttributesLine/ReadOnlyImageAttributesLine.test.js +89 -89
  36. package/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +556 -602
  37. package/ReferenceAttributeEditor/metadata.test-data.d.ts +13 -13
  38. package/ReferenceAttributeEditor/metadata.test-data.js +2 -2
  39. package/ReferenceAttributeEditor/styles.d.ts +1 -1
  40. package/RelationEditor/RelationEditor.test.js +1448 -1392
  41. package/RelationTypeSelector/RelationTypeSelector.test.js +99 -17
  42. package/RelationTypesSelector/RelationTypesSelector.test.js +73 -22
  43. package/ReltioMap/ReltioMap.spec.js +51 -25
  44. package/Roles/Roles.test.js +54 -10
  45. package/ScreenProfileBand/ScreenProfileBand.test.js +142 -72
  46. package/cjs/FacetViewHeader/FacetViewHeader.js +1 -1
  47. package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +8 -0
  48. package/cjs/ImageAttributesLine/index.d.ts +1 -1
  49. package/cjs/ImageAttributesLine/index.js +2 -1
  50. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +1 -1
  51. package/cjs/MergeButton/MergeButton.spec.js +55 -124
  52. package/cjs/MetadataTypesSelector/MetadataTypesSelector.js +1 -1
  53. package/cjs/MetadataTypesSelector/MetadataTypesSelector.test.js +193 -190
  54. package/cjs/MoreAttributesButton/MoreAttributesButton.test.js +172 -165
  55. package/cjs/MultiValueSelector/MultiValueSelector.test.js +78 -38
  56. package/cjs/MultipliableSelect/MultipliableSelect.test.js +111 -47
  57. package/cjs/NestedAttribute/NestedAttribute.test.js +121 -42
  58. package/cjs/NestedAttributeEditor/NestedAttributeEditor.test.js +94 -40
  59. package/cjs/NotMatchButton/NotMatchButton.spec.js +51 -100
  60. package/cjs/PieChart/PieChart.test.js +130 -114
  61. package/cjs/PinButton/PinButton.spec.js +89 -22
  62. package/cjs/PivotingTooltip/PivotingTooltip.test.js +338 -174
  63. package/cjs/PotentialMatchReviewCard/PotentialMatchReviewCard.spec.js +94 -29
  64. package/cjs/ProfileBand/ProfileBand.spec.js +60 -53
  65. package/cjs/ProfileCard/ProfileCard.test.js +109 -27
  66. package/cjs/ProfilesList/ProfilesList.d.ts +1 -3
  67. package/cjs/ProfilesList/ProfilesList.js +1 -1
  68. package/cjs/ProfilesList/ProfilesList.spec.js +226 -211
  69. package/cjs/QueryBuilderRow/QueryBuilderRow.spec.js +83 -90
  70. package/cjs/QueryBuilderRowsGroup/QueryBuilderRowsGroup.spec.js +195 -86
  71. package/cjs/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +73 -15
  72. package/cjs/ReactSelectMenuWithPopper/ReactSelectMenuWithPopper.test.js +71 -117
  73. package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +128 -61
  74. package/cjs/ReadOnlyAttributesFactory/components/ReadOnlyAttribute/ReadOnlyAttribute.test.js +179 -44
  75. package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +254 -211
  76. package/cjs/ReadOnlyAttributesList/attributes.test-data.js +4 -4
  77. package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +75 -18
  78. package/cjs/ReadOnlyAttributesView/ReadOnlyAttributesView.test.js +185 -310
  79. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +209 -218
  80. package/cjs/ReadOnlyImageAttributesLine/ReadOnlyImageAttributesLine.test.js +89 -89
  81. package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +555 -601
  82. package/cjs/ReferenceAttributeEditor/metadata.test-data.d.ts +13 -13
  83. package/cjs/ReferenceAttributeEditor/metadata.test-data.js +2 -2
  84. package/cjs/ReferenceAttributeEditor/styles.d.ts +1 -1
  85. package/cjs/RelationEditor/RelationEditor.test.js +1446 -1390
  86. package/cjs/RelationTypeSelector/RelationTypeSelector.test.js +99 -17
  87. package/cjs/RelationTypesSelector/RelationTypesSelector.test.js +73 -22
  88. package/cjs/ReltioMap/ReltioMap.spec.js +51 -25
  89. package/cjs/Roles/Roles.test.js +54 -10
  90. package/cjs/ScreenProfileBand/ScreenProfileBand.test.js +141 -71
  91. package/package.json +2 -2
  92. package/MetadataTypesSelector/components/ListLabel/ListLabel.test.d.ts +0 -1
  93. package/MetadataTypesSelector/components/ListLabel/ListLabel.test.js +0 -24
  94. package/PivotingTooltip/IntegrationPivotingTooltip.test.d.ts +0 -1
  95. package/PivotingTooltip/IntegrationPivotingTooltip.test.js +0 -356
  96. package/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.d.ts +0 -1
  97. package/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +0 -201
  98. package/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.d.ts +0 -1
  99. package/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.js +0 -43
  100. package/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.d.ts +0 -1
  101. package/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.js +0 -31
  102. package/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.d.ts +0 -1
  103. package/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.js +0 -31
  104. package/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
  105. package/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -45
  106. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.d.ts +0 -1
  107. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.js +0 -114
  108. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.d.ts +0 -1
  109. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.js +0 -107
  110. package/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
  111. package/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -72
  112. package/RelationEditor/IntegrationRelationEditor.test.d.ts +0 -1
  113. package/RelationEditor/IntegrationRelationEditor.test.js +0 -337
  114. package/ReltioMap/components/MapControlContainer/MapControlContainer.d.ts +0 -10
  115. package/ReltioMap/components/MapControlContainer/MapControlContainer.js +0 -24
  116. package/ReltioMap/components/MapControlContainer/MapControlContainer.spec.d.ts +0 -1
  117. package/ReltioMap/components/MapControlContainer/MapControlContainer.spec.js +0 -33
  118. package/ReltioMap/components/MapControlContainer/index.d.ts +0 -1
  119. package/ReltioMap/components/MapControlContainer/index.js +0 -1
  120. package/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.d.ts +0 -1
  121. package/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.js +0 -36
  122. package/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.d.ts +0 -1
  123. package/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.js +0 -60
  124. package/Roles/components/Role/Role.test.d.ts +0 -1
  125. package/Roles/components/Role/Role.test.js +0 -55
  126. package/cjs/MetadataTypesSelector/components/ListLabel/ListLabel.test.d.ts +0 -1
  127. package/cjs/MetadataTypesSelector/components/ListLabel/ListLabel.test.js +0 -52
  128. package/cjs/PivotingTooltip/IntegrationPivotingTooltip.test.d.ts +0 -1
  129. package/cjs/PivotingTooltip/IntegrationPivotingTooltip.test.js +0 -361
  130. package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.d.ts +0 -1
  131. package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +0 -206
  132. package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.d.ts +0 -1
  133. package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.js +0 -48
  134. package/cjs/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.d.ts +0 -1
  135. package/cjs/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.js +0 -36
  136. package/cjs/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.d.ts +0 -1
  137. package/cjs/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.js +0 -36
  138. package/cjs/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
  139. package/cjs/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -50
  140. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.d.ts +0 -1
  141. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.js +0 -119
  142. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.d.ts +0 -1
  143. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.js +0 -112
  144. package/cjs/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
  145. package/cjs/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -77
  146. package/cjs/RelationEditor/IntegrationRelationEditor.test.d.ts +0 -1
  147. package/cjs/RelationEditor/IntegrationRelationEditor.test.js +0 -342
  148. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.d.ts +0 -10
  149. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.js +0 -28
  150. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.spec.d.ts +0 -1
  151. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.spec.js +0 -38
  152. package/cjs/ReltioMap/components/MapControlContainer/index.d.ts +0 -1
  153. package/cjs/ReltioMap/components/MapControlContainer/index.js +0 -5
  154. package/cjs/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.d.ts +0 -1
  155. package/cjs/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.js +0 -41
  156. package/cjs/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.d.ts +0 -1
  157. package/cjs/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.js +0 -65
  158. package/cjs/Roles/components/Role/Role.test.d.ts +0 -1
  159. package/cjs/Roles/components/Role/Role.test.js +0 -60
@@ -9,228 +9,243 @@ 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
+ };
48
+ var _a;
12
49
  import React from 'react';
13
- import { mount } from 'enzyme';
14
- import { EmptyStub } from '../EmptyStub';
50
+ import { render, screen, within } from '@testing-library/react';
51
+ import userEvent from '@testing-library/user-event';
15
52
  import { MdmModuleProvider } from '../contexts/MdmModuleContext';
16
- import { EntityUriLink } from '../EntityUriLink';
17
- import { EntityAvatar } from '../EntityAvatar';
18
- import { ProfilesList } from './ProfilesList';
19
53
  import { ImportModes } from '../types';
20
- var EntityAvatarMock = function () { return React.createElement("div", null); };
21
- jest.mock('../EntityAvatar', function () { return ({
22
- EntityAvatar: EntityAvatarMock
23
- }); });
24
- describe('ProfilesList tests', function () {
25
- var entities = [
26
- {
27
- attributes: {},
28
- label: 'First entity',
29
- secondaryLabel: 'secondary label',
30
- type: 'configuration/entityTypes/HCP',
31
- uri: 'entities/18TTRAuB',
32
- defaultProfilePicValue: 'https://engineering.unl.edu/images/staff/Kayla_Person-small.jpg'
33
- },
34
- {
35
- attributes: {
36
- BCard1: [
37
- {
38
- type: 'configuration/entityTypes/HCP/attributes/BCard1',
39
- ov: true,
40
- value: 'Business card 1 test',
41
- uri: 'entities/45TTRAfg/attributes/BCard1/1hPAy491H'
42
- }
43
- ],
44
- BCard2: [
45
- {
46
- type: 'configuration/entityTypes/HCP/attributes/BCard2',
47
- ov: true,
48
- value: 'Business card 2 test',
49
- uri: 'entities/45TTRAfg/attributes/BCard2/1hPAy491H',
50
- label: 'Main Label - Business card second',
51
- relationshipLabel: 'Relationship Label'
52
- }
53
- ]
54
- },
55
- label: 'Second entity',
56
- secondaryLabel: '',
57
- type: 'configuration/entityTypes/HCP',
58
- uri: 'entities/45TTRAfg'
54
+ import { ProfilesList } from './ProfilesList';
55
+ var entities = [
56
+ {
57
+ attributes: {},
58
+ label: 'First entity',
59
+ secondaryLabel: 'secondary label',
60
+ type: 'configuration/entityTypes/HCP',
61
+ uri: 'entities/18TTRAuB',
62
+ defaultProfilePic: 'https://engineering.unl.edu/images/staff/Kayla_Person-small.jpg',
63
+ endDate: Date.now() - 10
64
+ },
65
+ {
66
+ attributes: {
67
+ BCard1: [
68
+ {
69
+ type: 'configuration/entityTypes/HCP/attributes/BCard1',
70
+ ov: true,
71
+ value: 'Business card 1 test',
72
+ uri: 'entities/45TTRAfg/attributes/BCard1/1hPAy491H'
73
+ }
74
+ ],
75
+ BCard2: [
76
+ {
77
+ type: 'configuration/entityTypes/HCP/attributes/BCard2',
78
+ ov: true,
79
+ value: 'Business card 2 test',
80
+ uri: 'entities/45TTRAfg/attributes/BCard2/1hPAy491H',
81
+ label: 'Main Label - Business card second',
82
+ relationshipLabel: 'Relationship Label'
83
+ }
84
+ ]
59
85
  },
86
+ label: 'Second entity',
87
+ secondaryLabel: '',
88
+ type: 'configuration/entityTypes/HCP',
89
+ uri: 'entities/45TTRAfg'
90
+ },
91
+ {
92
+ attributes: {},
93
+ label: 'Third entity',
94
+ secondaryLabel: '',
95
+ type: 'configuration/entityTypes/HCP',
96
+ uri: 'DTSS/entities/14Pp52PY'
97
+ },
98
+ {
99
+ attributes: {},
100
+ label: 'Fourth entity',
101
+ secondaryLabel: 'secondary label',
102
+ type: 'configuration/entityTypes/HCP',
103
+ uri: 'entities/19TTRAuB',
104
+ dataTenant: 'dt1'
105
+ },
106
+ {
107
+ uri: 'entities/84Ks3mN',
108
+ attributes: {},
109
+ type: 'NO_LABEL'
110
+ }
111
+ ];
112
+ var metadata = {
113
+ entityTypes: [
60
114
  {
61
- attributes: {},
62
- label: 'Third entity',
63
- secondaryLabel: '',
64
- type: 'configuration/entityTypes/HCP',
65
- uri: 'DTSS/entities/14Pp52PY'
115
+ uri: 'configuration/entityTypes/HCP',
116
+ typeColor: '#676767',
117
+ attributes: [
118
+ {
119
+ type: 'String',
120
+ name: 'BCard1',
121
+ label: 'BCard1',
122
+ uri: 'configuration/entityTypes/HCP/attributes/BCard1'
123
+ },
124
+ {
125
+ type: 'String',
126
+ name: 'BCard2',
127
+ label: 'BCard2',
128
+ uri: 'configuration/entityTypes/HCP/attributes/BCard2'
129
+ },
130
+ {
131
+ type: 'String',
132
+ name: 'BCard3',
133
+ label: 'BCard3',
134
+ uri: 'configuration/entityTypes/HCP/attributes/BCard3'
135
+ }
136
+ ],
137
+ businessCardAttributeURIs: [
138
+ 'configuration/entityTypes/HCP/attributes/BCard1',
139
+ 'configuration/entityTypes/HCP/attributes/BCard2',
140
+ 'configuration/entityTypes/HCP/attributes/BCard3',
141
+ 'configuration/entityTypes/HCP/attributes/NotExistingBCard'
142
+ ],
143
+ label: 'HCP',
144
+ typeImage: 'images/defaultImage/neutral.png'
66
145
  },
67
146
  {
68
- attributes: {},
69
- label: 'Fourth entity',
70
- secondaryLabel: 'secondary label',
71
- type: 'configuration/entityTypes/HCP',
72
- uri: 'entities/19TTRAuB',
73
- dataTenant: 'dt1'
147
+ uri: 'NO_LABEL',
148
+ attributes: []
74
149
  }
75
- ];
76
- var findItem = function (component) { return component.find('.item'); };
77
- var findInactiveItem = function (component) { return component.find('.item.inactive'); };
78
- var findSelectedItem = function (component) { return component.find('.item.selected'); };
79
- var findClickableItem = function (component) { return component.find('.item.clickable'); };
80
- var findItemLink = function (item) { return item.find(EntityUriLink); };
81
- var metadata = {
82
- entityTypes: [
83
- {
84
- uri: 'configuration/entityTypes/HCP',
85
- typeColor: '#676767',
86
- attributes: [
87
- {
88
- name: 'BCard1',
89
- label: 'BCard1',
90
- uri: 'configuration/entityTypes/HCP/attributes/BCard1'
91
- },
92
- {
93
- name: 'BCard2',
94
- label: 'BCard2',
95
- uri: 'configuration/entityTypes/HCP/attributes/BCard2'
96
- },
97
- {
98
- name: 'BCard3',
99
- label: 'BCard3',
100
- uri: 'configuration/entityTypes/HCP/attributes/BCard3'
101
- }
102
- ],
103
- businessCardAttributeURIs: [
104
- 'configuration/entityTypes/HCP/attributes/BCard1',
105
- 'configuration/entityTypes/HCP/attributes/BCard2',
106
- 'configuration/entityTypes/HCP/attributes/BCard3',
107
- 'configuration/entityTypes/HCP/attributes/NotExistingBCard'
108
- ],
109
- label: 'entityType HCP Label',
110
- typeImage: 'images/defaultImage/neutral.png'
111
- },
112
- {
113
- uri: 'NO_LABEL',
114
- attributes: []
115
- }
116
- ]
117
- };
118
- var mdmValues = { uiPath: 'https://reltio.com/ui', metadata: metadata };
119
- var defaultProps = {
120
- metadata: metadata,
121
- entities: entities,
122
- entitiesImportStatus: {},
123
- onEntityImportStatusChange: jest.fn(),
124
- entityButtonsRenderer: function (entity) {
125
- return React.createElement(EmptyStub, { entity: entity });
126
- }
127
- };
128
- var setUp = function (props) {
129
- if (props === void 0) { props = defaultProps; }
130
- var Component = function (props) { return (React.createElement(MdmModuleProvider, { values: mdmValues },
131
- React.createElement(ProfilesList, __assign({}, props)))); };
132
- return mount(React.createElement(Component, __assign({}, props)));
150
+ ]
151
+ };
152
+ var mdmValues = { uiPath: 'https://reltio.com/ui', metadata: metadata };
153
+ var defaultProps = {
154
+ metadata: metadata,
155
+ entities: entities,
156
+ entitiesImportStatus: (_a = {},
157
+ _a[entities[1].uri] = ImportModes.Success,
158
+ _a),
159
+ selectedEntityUri: entities[2].uri,
160
+ entityToHighlight: entities[3].uri,
161
+ onEntityImportStatusChange: jest.fn(),
162
+ entityButtonsRenderer: jest.fn(function () { return null; })
163
+ };
164
+ var setUp = function (props) {
165
+ if (props === void 0) { props = defaultProps; }
166
+ var user = userEvent.setup();
167
+ var Providers = function (_a) {
168
+ var children = _a.children;
169
+ return (React.createElement(MdmModuleProvider, { values: mdmValues }, children));
133
170
  };
134
- it('should not fail when no props', function () {
135
- var component = setUp({});
136
- expect(findItem(component).length).toBe(0);
137
- });
138
- it('should render items', function () {
139
- var component = setUp();
140
- expect(findItem(component).length).toBe(defaultProps.entities.length);
141
- });
142
- it('should render main parts of item', function () {
143
- var _a;
144
- var entity = entities[0];
145
- var props = __assign(__assign({}, defaultProps), { entities: [entity], entitiesImportStatus: (_a = {},
146
- _a[entity.uri] = ImportModes.Progress,
147
- _a) });
148
- var component = setUp(props);
149
- var item = findItem(component);
150
- expect(item.length).toBe(1);
151
- var avatar = item.find(EntityAvatar);
152
- expect(avatar.length).toBe(1);
153
- expect(avatar.prop('entity')).toBe(entity);
154
- expect(item.text().includes('First entity')).toBe(true);
155
- expect(item.text().includes('secondary label')).toBe(true);
156
- expect(item.text().includes('entityType HCP Label')).toBe(true);
157
- expect(item.text().includes('18TTRAuB')).toBe(true);
158
- expect(item.text().includes('entities/18TTRAuB')).toBe(false);
159
- expect(findInactiveItem(component).length).toBe(0);
160
- expect(findClickableItem(component).length).toBe(0);
161
- expect(findSelectedItem(component).length).toBe(0);
162
- expect(item.find(EmptyStub).length).toBe(1);
163
- expect(item.find(EmptyStub).props()).toEqual({ entity: entity });
164
- });
165
- it('should show full entityId when it does not start with "entities/"', function () {
166
- var entity = entities[2];
167
- var props = __assign(__assign({}, defaultProps), { entities: [entity] });
168
- var component = setUp(props);
169
- var item = findItem(component);
170
- expect(item.text().includes('DTSS/entities/14Pp52PY')).toBe(true);
171
- });
172
- it('should show No label caption when there is no label', function () {
173
- var entity = { uri: '1', attributes: {}, type: 'NO_LABEL' };
174
- var props = __assign(__assign({}, defaultProps), { entities: [entity] });
175
- var component = setUp(props);
176
- var item = findItem(component);
177
- expect(item.text().includes('<No label>')).toBe(true);
178
- });
179
- it('should render business card attributes', function () {
180
- var entity = entities[1];
181
- var props = __assign(__assign({}, defaultProps), { entities: [entity] });
182
- var component = setUp(props);
183
- expect(findItem(component)
184
- .text()
185
- .includes('Business card 1 test, Relationship Label, Main Label - Business card second')).toBe(true);
186
- });
187
- it('should render inactive items', function () {
188
- var inactiveEntities = entities.map(function (entity) { return (__assign(__assign({}, entity), { endDate: Date.now() - 10 })); });
189
- var props = __assign(__assign({}, defaultProps), { entities: inactiveEntities });
190
- var component = setUp(props);
191
- expect(findInactiveItem(component).length).toBe(entities.length);
192
- });
193
- it('should show highlight for entity if it has import status SUCCESS', function () {
194
- var _a;
195
- var entity = entities[3];
196
- var entitiesImportStatus = (_a = {},
197
- _a[entity.uri] = ImportModes.Success,
198
- _a);
199
- var props = __assign(__assign({}, defaultProps), { entities: [entity] });
200
- var component = setUp(props);
201
- expect(findItem(component).hasClass('justImported')).toBe(false);
202
- component.setProps({ entitiesImportStatus: entitiesImportStatus });
203
- expect(findItem(component).hasClass('justImported')).toBe(true);
171
+ return __assign(__assign({}, render(React.createElement(ProfilesList, __assign({}, props)), { wrapper: Providers })), { user: user });
172
+ };
173
+ describe('Profiles list tests', function () {
174
+ it('should render correctly', function () {
175
+ setUp();
176
+ var items = screen.getAllByTestId('profiles-list-item');
177
+ expect(items).toHaveLength(5);
178
+ expect(items[0]).not.toHaveClass('clickable');
179
+ expect(items[0]).not.toHaveClass('highlighted');
180
+ expect(items[0]).not.toHaveClass('selected');
181
+ expect(items[0]).toHaveClass('inactive');
182
+ expect(items[0]).not.toHaveClass('justImported');
183
+ expect(within(items[0]).getByRole('img')).toHaveAttribute('src', '/images/defaultImage/neutral.png');
184
+ expect(within(items[0]).getByText('First entity')).toHaveAttribute('href', 'https://reltio.com/ui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/18TTRAuB');
185
+ within(items[0]).getByText('secondary label');
186
+ within(items[0]).getByText('HCP');
187
+ within(items[0]).getByText('18TTRAuB');
188
+ expect(items[1]).not.toHaveClass('clickable');
189
+ expect(items[1]).not.toHaveClass('highlighted');
190
+ expect(items[1]).not.toHaveClass('selected');
191
+ expect(items[1]).toHaveClass('justImported');
192
+ expect(items[1]).not.toHaveClass('inactive');
193
+ expect(within(items[1]).getByRole('img')).toHaveAttribute('src', '/images/defaultImage/neutral.png');
194
+ expect(within(items[1]).getByText('Second entity')).toHaveAttribute('href', 'https://reltio.com/ui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/45TTRAfg');
195
+ within(items[1]).getByText('Business card 1 test, Relationship Label, Main Label - Business card second');
196
+ within(items[1]).getByText('HCP');
197
+ within(items[1]).getByText('45TTRAfg');
198
+ expect(items[2]).not.toHaveClass('clickable');
199
+ expect(items[2]).not.toHaveClass('highlighted');
200
+ expect(items[2]).toHaveClass('selected');
201
+ expect(items[2]).not.toHaveClass('justImported');
202
+ expect(items[2]).not.toHaveClass('inactive');
203
+ expect(within(items[2]).getByRole('img')).toHaveAttribute('src', '/images/defaultImage/neutral.png');
204
+ expect(within(items[2]).getByText('Third entity')).toHaveAttribute('href', 'https://reltio.com/ui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~DTSS/entities/14Pp52PY');
205
+ within(items[2]).getByText('HCP');
206
+ within(items[2]).getByText('DTSS/entities/14Pp52PY');
207
+ expect(items[3]).not.toHaveClass('clickable');
208
+ expect(items[3]).toHaveClass('highlighted');
209
+ expect(items[3]).not.toHaveClass('selected');
210
+ expect(items[3]).not.toHaveClass('justImported');
211
+ expect(items[3]).not.toHaveClass('inactive');
212
+ expect(within(items[3]).getByRole('img')).toHaveAttribute('src', '/images/defaultImage/neutral.png');
213
+ expect(within(items[3]).getByText('Fourth entity')).toHaveAttribute('href', 'https://reltio.com/ui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~DTSS/dt1/entities/19TTRAuB');
214
+ within(items[3]).getByText('secondary label');
215
+ within(items[3]).getByText('HCP');
216
+ within(items[3]).getByText('DTSS/dt1/entities/19TTRAuB');
217
+ expect(items[4]).not.toHaveClass('clickable');
218
+ expect(items[4]).not.toHaveClass('highlighted');
219
+ expect(items[4]).not.toHaveClass('selected');
220
+ expect(items[4]).not.toHaveClass('justImported');
221
+ expect(items[4]).not.toHaveClass('inactive');
222
+ expect(within(items[4]).getByText('<No label>')).toHaveAttribute('href', 'https://reltio.com/ui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/84Ks3mN');
223
+ within(items[4]).getByText('84Ks3mN');
204
224
  });
205
225
  it('should render items as clickable if onEntityClick prop is defined', function () {
206
226
  var props = __assign(__assign({}, defaultProps), { onEntityClick: function () { } });
207
- var component = setUp(props);
208
- expect(findClickableItem(component).length).toBe(entities.length);
209
- });
210
- it('should render selected item according selectedEntityUri prop', function () {
211
- var props = __assign(__assign({}, defaultProps), { onEntityClick: function () { }, selectedEntityUri: entities[1].uri });
212
- var component = setUp(props);
213
- expect(findClickableItem(component).length).toBe(entities.length);
214
- expect(findSelectedItem(component).length).toBe(1);
215
- });
216
- it('should render entity link uri component', function () {
217
- var component = setUp();
218
- var firstLink = findItemLink(findItem(component).at(0));
219
- expect(firstLink.prop('value')).toBe('entities/18TTRAuB');
220
- expect(firstLink.text()).toBe(entities[0].label);
221
- });
222
- it('should call "onEntityHover" prop with entity uri on item mouse enter', function () {
223
- var onEntityHover = jest.fn();
224
- var props = __assign(__assign({}, defaultProps), { onEntityHover: onEntityHover, entities: [entities[0]], selectedEntityUri: entities[1].uri });
225
- var component = setUp(props);
226
- findItem(component).prop('onMouseEnter')();
227
- expect(onEntityHover).toHaveBeenCalledWith(entities[0].uri);
228
- });
229
- it('should call "onEntityHover" prop with null on item mouse leave', function () {
230
- var onEntityHover = jest.fn();
231
- var props = __assign(__assign({}, defaultProps), { onEntityHover: onEntityHover, entities: [entities[0]], selectedEntityUri: entities[1].uri });
232
- var component = setUp(props);
233
- findItem(component).prop('onMouseLeave')();
234
- expect(onEntityHover).toHaveBeenCalledWith(null);
227
+ setUp(props);
228
+ var items = screen.getAllByTestId('profiles-list-item');
229
+ expect(items).toHaveLength(5);
230
+ items.forEach(function (item) { return expect(item).toHaveClass('clickable'); });
235
231
  });
232
+ it('should call "onEntityHover" prop on item mouse enter and mouse leave correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
233
+ var props, user;
234
+ return __generator(this, function (_a) {
235
+ switch (_a.label) {
236
+ case 0:
237
+ props = __assign(__assign({}, defaultProps), { onEntityHover: jest.fn() });
238
+ user = setUp(props).user;
239
+ return [4 /*yield*/, user.hover(screen.getByText('First entity'))];
240
+ case 1:
241
+ _a.sent();
242
+ expect(props.onEntityHover).toHaveBeenCalledWith('entities/18TTRAuB');
243
+ return [4 /*yield*/, user.unhover(screen.getByText('First entity'))];
244
+ case 2:
245
+ _a.sent();
246
+ expect(props.onEntityHover).toHaveBeenCalledWith(null);
247
+ return [2 /*return*/];
248
+ }
249
+ });
250
+ }); });
236
251
  });