@reltio/components 1.4.2070 → 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 +1 -1
  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,6 +9,42 @@ 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
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
49
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
50
  if (ar || !(i in from)) {
@@ -19,95 +55,100 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
55
  return to.concat(ar || Array.prototype.slice.call(from));
20
56
  };
21
57
  import React from 'react';
22
- import { shallow } from 'enzyme';
23
- import ReadOnlyAttributesList from './ReadOnlyAttributesList';
24
- import { ReadOnlyAttributesPager } from '../ReadOnlyAttributesPager';
58
+ import { render, screen, within } from '@testing-library/react';
59
+ import userEvent from '@testing-library/user-event';
25
60
  import { EntityAttrTypes } from '@reltio/mdm-sdk';
26
- import { BranchDecorator } from '../BranchDecorator';
27
- import { ShowMore } from '../ShowMore';
28
- import { ShowLess } from '../ShowLess';
61
+ import ReadOnlyAttributesList from './ReadOnlyAttributesList';
29
62
  import { attributesList } from './attributes.test-data';
30
- import { rerenderWrapper } from '../test-utils';
31
- describe('ReadOnlyAttributesList tests', function () {
32
- var attributes = {
63
+ import { MdmModuleProvider } from '../contexts/MdmModuleContext';
64
+ var defaultEntity = {
65
+ type: 'configuration/entityTypes/HCP',
66
+ uri: 'entities/xT3HJZ7',
67
+ attributes: {
33
68
  Role: [
34
69
  {
35
70
  ov: true,
36
- type: 'configuration/relationTypes/knowledge/attributes/Role',
37
- uri: 'relations/8908/Role',
38
- value: ''
71
+ type: 'configuration/entityTypes/HCP/attributes/Role',
72
+ uri: 'entities/xT3HJZ7/attributes/Role/nAs391Ab',
73
+ value: 'Some role 1'
39
74
  },
40
75
  {
41
76
  ov: true,
42
- type: 'configuration/relationTypes/knowledge/attributes/Role',
43
- uri: 'relations/8909/Role',
44
- value: 'Some role'
77
+ type: 'configuration/entityTypes/HCP/attributes/Role',
78
+ uri: 'entities/xT3HJZ7/attributes/Role/8AmySE1',
79
+ value: 'Some role 2'
45
80
  }
46
81
  ],
47
82
  Name: [
48
83
  {
49
84
  ov: true,
50
- type: 'configuration/relationTypes/knowledge/attributes/Name',
51
- uri: 'relations/8808/Name',
52
- value: ''
85
+ type: 'configuration/entityTypes/HCP/attributes/Name',
86
+ uri: 'entities/xT3HJZ7/attributes/Name/8Ans02G',
87
+ value: 'Some name'
53
88
  }
54
89
  ],
55
90
  LastName: [
56
91
  {
57
92
  ov: true,
58
- type: 'configuration/relationTypes/knowledge/attributes/LastName',
59
- uri: 'relations/7808/LastName',
60
- value: ''
93
+ type: 'configuration/entityTypes/HCP/attributes/LastName',
94
+ uri: 'entities/xT3HJZ7/attributes/LastName/pZXO45h',
95
+ value: 'Some last name'
61
96
  }
62
97
  ],
63
98
  paging: {
64
- 'configuration/relationTypes/knowledge/attributes/Role': {
99
+ 'configuration/entityTypes/HCP/attributes/Role': {
65
100
  totalOvValues: 4,
66
101
  totalValues: 4
67
102
  }
68
103
  }
104
+ }
105
+ };
106
+ var defaultMetadata = {
107
+ entityTypes: [{ uri: 'configuration/entityTypes/HCP', label: 'HCP', attributes: attributesList }]
108
+ };
109
+ var defaultProps = {
110
+ entity: defaultEntity,
111
+ attrTypes: attributesList,
112
+ parentUri: 'entities/xT3HJZ7'
113
+ };
114
+ var defaultMdmValues = {
115
+ metadata: defaultMetadata,
116
+ entity: defaultEntity
117
+ };
118
+ var setUp = function (_a) {
119
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
120
+ var user = userEvent.setup();
121
+ var Providers = function (_a) {
122
+ var children = _a.children;
123
+ return (React.createElement(MdmModuleProvider, { values: mdmValues }, children));
69
124
  };
70
- var entity = { attributes: attributes };
71
- var parentUri = 'entities/xT3HJZ7';
125
+ return __assign(__assign({}, render(React.createElement(ReadOnlyAttributesList, __assign({}, props)), { wrapper: Providers })), { user: user });
126
+ };
127
+ describe('Read only attributes list tests', function () {
72
128
  it('should render pagers for not hidden attribute types and for existing attributes', function () {
73
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attributesList, entity: entity, parentUri: parentUri }));
74
- var pagers = component.find(ReadOnlyAttributesPager);
75
- expect(pagers.length).toBe(2);
76
- pagers.forEach(function (pager) {
77
- expect(pager.prop('attributeType').hidden).toBeFalsy();
78
- var shouldHasPaging = pager.prop('attributeType').uri === 'configuration/relationTypes/knowledge/attributes/Role';
79
- expect(pager.prop('paging')).toBe(shouldHasPaging ? attributes.paging['configuration/relationTypes/knowledge/attributes/Role'] : undefined);
80
- });
129
+ setUp();
130
+ var multiLineRenderer = screen.getByTestId('multi-line-renderer');
131
+ var multiLineRendererLabel = within(multiLineRenderer).getByTestId('reltio-attribute-label');
132
+ var multiLineRendererValues = within(multiLineRenderer).getAllByTestId('reltio-attribute-value');
133
+ expect(multiLineRendererLabel).toHaveTextContent('Role');
134
+ expect(multiLineRendererValues).toHaveLength(2);
135
+ expect(multiLineRendererValues[0]).toHaveTextContent('Some role 1');
136
+ expect(multiLineRendererValues[1]).toHaveTextContent('Some role 2');
137
+ var oneLineRenderer = screen.getByTestId('one-line-renderer');
138
+ var oneLineRendererLabel = within(oneLineRenderer).getByTestId('reltio-attribute-label');
139
+ var oneLineRendererValues = within(oneLineRenderer).getAllByTestId('reltio-attribute-value');
140
+ expect(oneLineRendererLabel).toHaveTextContent('Name');
141
+ expect(oneLineRendererValues).toHaveLength(1);
142
+ expect(oneLineRendererValues[0]).toHaveTextContent('Some name');
81
143
  });
82
144
  it('should render pagers for attributes and analytics attributes with same name', function () {
83
- var attributes = {
84
- Name: [
85
- {
86
- ov: true,
87
- type: 'configuration/relationTypes/knowledge/attributes/Name',
88
- uri: 'relations/8808/Name',
89
- value: 'SimpleName'
90
- }
91
- ]
92
- };
93
- var analyticsAttributes = {
94
- Name: [
95
- {
96
- ov: true,
97
- type: 'configuration/relationTypes/knowledge/analyticsAttributes/Name',
98
- uri: 'relations/8808/Name',
99
- value: 'analyticsName'
100
- }
101
- ]
102
- };
103
- var entity = { attributes: attributes, analyticsAttributes: analyticsAttributes };
104
145
  var attrTypes = [
105
146
  {
106
147
  label: 'Name',
107
148
  name: 'Name',
108
149
  type: 'String',
109
150
  hidden: false,
110
- uri: 'configuration/relationTypes/knowledge/attributes/Name',
151
+ uri: 'configuration/entityTypes/HCP/attributes/Name',
111
152
  access: ['CREATE', 'READ', 'INITIATE_CHANGE_REQUEST', 'UPDATE']
112
153
  },
113
154
  {
@@ -115,183 +156,185 @@ describe('ReadOnlyAttributesList tests', function () {
115
156
  name: 'Name',
116
157
  type: 'String',
117
158
  hidden: false,
118
- uri: 'configuration/relationTypes/knowledge/analyticsAttributes/Name',
159
+ uri: 'configuration/entityTypes/HCP/analyticsAttributes/Name',
119
160
  access: ['CREATE', 'READ', 'INITIATE_CHANGE_REQUEST', 'UPDATE']
120
161
  }
121
162
  ];
122
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attrTypes, entity: entity }));
123
- var pagers = component.find(ReadOnlyAttributesPager);
124
- expect(pagers.length).toBe(2);
125
- expect(pagers.at(0).prop('attributeType')).toEqual(attrTypes[0]);
126
- expect(pagers.at(0).prop('values')).toEqual(attributes.Name);
127
- expect(pagers.at(1).prop('attributeType')).toEqual(attrTypes[1]);
128
- expect(pagers.at(1).prop('values')).toEqual(analyticsAttributes.Name);
163
+ var entity = __assign(__assign({}, defaultEntity), { attributes: {
164
+ Name: [
165
+ {
166
+ ov: true,
167
+ type: 'configuration/entityTypes/HCP/attributes/Name',
168
+ uri: 'entities/xT3HJZ7/attributes/Name/8Ans02G',
169
+ value: 'Simple Name value'
170
+ }
171
+ ]
172
+ }, analyticsAttributes: {
173
+ Name: [
174
+ {
175
+ ov: true,
176
+ type: 'configuration/entityTypes/HCP/analyticsAttributes/Name',
177
+ uri: 'entities/xT3HJZ7/analyticsAttributes/Name/Bh20IkX',
178
+ value: 'Analytics Name value'
179
+ }
180
+ ]
181
+ } });
182
+ var props = __assign(__assign({}, defaultProps), { attrTypes: attrTypes, entity: entity });
183
+ setUp({ props: props });
184
+ var oneLineRenderers = screen.getAllByTestId('one-line-renderer');
185
+ within(oneLineRenderers[0]).getByText('Name');
186
+ within(oneLineRenderers[0]).getByText('Simple Name value');
187
+ within(oneLineRenderers[1]).getByText('Analytics Name');
188
+ within(oneLineRenderers[1]).getByText('Analytics Name value');
129
189
  });
130
190
  it('should not render pagers for attribute type without READ permission', function () {
131
191
  var attrTypes = __spreadArray([], attributesList, true);
132
192
  attrTypes[0] = __assign({}, attrTypes[0]);
133
193
  attrTypes[0].access = ['DELETE', 'UPDATE'];
134
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attrTypes, entity: entity, parentUri: parentUri }));
135
- var pager = component.find(ReadOnlyAttributesPager);
136
- expect(pager.length).toBe(1);
137
- expect(pager.prop('attributeType').hidden).toBeFalsy();
194
+ var props = __assign(__assign({}, defaultProps), { attrTypes: attrTypes });
195
+ setUp({ props: props });
196
+ screen.getByText('Name');
197
+ expect(screen.queryByText('Role')).not.toBeInTheDocument();
138
198
  });
139
199
  it('should not render pagers for attributes without ov values', function () {
140
- var attrs = __assign(__assign({}, attributes), { Role: [
141
- {
142
- //missing 'ov' should be interpreted as ov value
143
- type: 'configuration/relationTypes/knowledge/attributes/Role',
144
- uri: 'relations/8908/Role',
145
- value: ''
146
- },
147
- {
148
- ov: false,
149
- type: 'configuration/relationTypes/knowledge/attributes/Role',
150
- uri: 'relations/8909/Role',
151
- value: 'Some role'
152
- }
153
- ], Name: [
154
- {
155
- ov: false,
156
- type: 'configuration/relationTypes/knowledge/attributes/Name',
157
- uri: 'relations/8808/Name',
158
- value: ''
159
- }
160
- ] });
161
- var entity = { attributes: attrs };
162
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attributesList, entity: entity, parentUri: parentUri }));
163
- var pager = component.find(ReadOnlyAttributesPager);
164
- expect(pager.length).toBe(1);
165
- expect(pager.prop('attributeType').name).toBe('Role');
200
+ var entity = __assign(__assign({}, defaultEntity), { attributes: __assign(__assign({}, defaultEntity.attributes), { Role: [
201
+ {
202
+ //missing 'ov' should be interpreted as ov value
203
+ type: 'configuration/entityTypes/HCP/attributes/Role',
204
+ uri: 'entities/xT3HJZ7/attributes/Role/nAs391Ab',
205
+ value: 'Some role 1'
206
+ },
207
+ {
208
+ ov: false,
209
+ type: 'configuration/entityTypes/HCP/attributes/Role',
210
+ uri: 'entities/xT3HJZ7/attributes/Role/8AmySE1',
211
+ value: 'Some role 2'
212
+ }
213
+ ], Name: [
214
+ {
215
+ ov: false,
216
+ type: 'configuration/entityTypes/HCP/attributes/Name',
217
+ uri: 'entities/xT3HJZ7/attributes/Name/8Ans02G',
218
+ value: 'Some name'
219
+ }
220
+ ] }) });
221
+ var props = __assign(__assign({}, defaultProps), { entity: entity });
222
+ setUp({ props: props });
223
+ expect(screen.getByTestId('reltio-attribute-label')).toHaveTextContent('Role');
224
+ expect(screen.getByTestId('reltio-attribute-value')).toHaveTextContent('Some role 1');
166
225
  });
167
226
  it('should render pagers for attributes with ov false if showNonOv is true', function () {
168
- var attrs = __assign(__assign({}, attributes), { Name: [
169
- {
170
- ov: false,
171
- type: 'configuration/relationTypes/knowledge/attributes/Name',
172
- uri: 'relations/8808/Name',
173
- value: ''
174
- }
175
- ] });
176
- var entity = { attributes: attrs };
177
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attributesList, entity: entity, parentUri: parentUri, showNonOv: true }));
178
- var pager = component.find(ReadOnlyAttributesPager);
179
- expect(pager.length).toBe(2);
227
+ var entity = __assign(__assign({}, defaultEntity), { attributes: __assign(__assign({}, defaultEntity.attributes), { Name: [
228
+ {
229
+ ov: false,
230
+ type: 'configuration/entityTypes/HCP/attributes/Name',
231
+ uri: 'entities/xT3HJZ7/attributes/Name/8Ans02G',
232
+ value: 'Some name'
233
+ }
234
+ ] }) });
235
+ var props = __assign(__assign({}, defaultProps), { entity: entity, showNonOv: true });
236
+ setUp({ props: props });
237
+ screen.getByText('Name');
238
+ screen.getByText('Some name');
180
239
  });
181
240
  it('should render BranchDecorator for children', function () {
182
- var Child = function () { return React.createElement("span", null, "children"); };
183
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attributesList, entity: entity, parentUri: parentUri, drawLines: true },
184
- React.createElement(Child, null)));
185
- var decorators = component.find(BranchDecorator);
186
- expect(decorators.length).toBe(1);
187
- expect(decorators.at(0).prop('enabled')).toBe(true);
188
- expect(decorators.at(0).prop('plain')).toBeFalsy();
189
- expect(decorators.at(0).find(Child).length).toBe(1);
190
- });
191
- it('should render ShowMore and ShowLess', function () {
192
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attributesList, entity: entity, parentUri: parentUri, drawLines: true, max: 1 }));
193
- var pager = component.find(ReadOnlyAttributesPager);
194
- expect(pager.length).toBe(1);
195
- var showMoreButton = component.find(ShowMore);
196
- var showLessButton = component.find(ShowLess);
197
- expect(showMoreButton.length).toBe(1);
198
- expect(showLessButton.length).toBe(0);
199
- showMoreButton.prop('onClick')();
200
- rerenderWrapper(component);
201
- pager = component.find(ReadOnlyAttributesPager);
202
- expect(pager.length).toBe(2);
203
- showLessButton = component.find(ShowLess);
204
- showMoreButton = component.find(ShowMore);
205
- expect(showLessButton.length).toBe(1);
206
- expect(showMoreButton.length).toBe(0);
207
- showLessButton.prop('onClick')();
208
- rerenderWrapper(component);
209
- pager = component.find(ReadOnlyAttributesPager);
210
- expect(pager.length).toBe(1);
241
+ var props = __assign(__assign({}, defaultProps), { drawLines: true, children: React.createElement("span", null, "Children") });
242
+ setUp({ props: props });
243
+ var decorator = screen.getAllByTestId('branch-decorator')[0];
244
+ expect(decorator).toHaveTextContent('Children');
211
245
  });
212
- it('should not render ShowMore and ShowLess', function () {
213
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attributesList, entity: entity, parentUri: parentUri, drawLines: true }));
214
- var pager = component.find(ReadOnlyAttributesPager);
215
- expect(pager.length).toBe(2);
216
- var showMoreButton = component.find(ShowMore);
217
- var showLessButton = component.find(ShowLess);
218
- expect(showMoreButton.length).toBe(0);
219
- expect(showLessButton.length).toBe(0);
246
+ it('should render show more and show less', function () { return __awaiter(void 0, void 0, void 0, function () {
247
+ var props, user, labels;
248
+ return __generator(this, function (_a) {
249
+ switch (_a.label) {
250
+ case 0:
251
+ props = __assign(__assign({}, defaultProps), { max: 1 });
252
+ user = setUp({ props: props }).user;
253
+ labels = screen.getAllByTestId('reltio-attribute-label');
254
+ expect(labels).toHaveLength(1);
255
+ expect(labels[0]).toHaveTextContent('Role');
256
+ return [4 /*yield*/, user.click(screen.getByText('Show more'))];
257
+ case 1:
258
+ _a.sent();
259
+ labels = screen.getAllByTestId('reltio-attribute-label');
260
+ expect(labels).toHaveLength(2);
261
+ expect(labels[0]).toHaveTextContent('Role');
262
+ expect(labels[1]).toHaveTextContent('Name');
263
+ return [4 /*yield*/, user.click(screen.getByText('Show less'))];
264
+ case 2:
265
+ _a.sent();
266
+ labels = screen.getAllByTestId('reltio-attribute-label');
267
+ expect(labels).toHaveLength(1);
268
+ expect(labels[0]).toHaveTextContent('Role');
269
+ return [2 /*return*/];
270
+ }
271
+ });
272
+ }); });
273
+ it('should not render show more and show less', function () {
274
+ setUp();
275
+ expect(screen.queryByText('Show more')).not.toBeInTheDocument();
276
+ expect(screen.queryByText('Show less')).not.toBeInTheDocument();
220
277
  });
221
- it('should not render ShowMore and ShowLess when total count of items is lower than max', function () {
222
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attributesList, entity: entity, parentUri: parentUri, drawLines: true, max: 4 }));
223
- var pager = component.find(ReadOnlyAttributesPager);
224
- expect(pager.length).toBe(2);
225
- var showMoreButton = component.find(ShowMore);
226
- var showLessButton = component.find(ShowLess);
227
- expect(showMoreButton.length).toBe(0);
228
- expect(showLessButton.length).toBe(0);
278
+ it('should not render show more and show less when total count of items is lower than max', function () {
279
+ var props = __assign(__assign({}, defaultProps), { max: 4 });
280
+ setUp({ props: props });
281
+ expect(screen.queryByText('Show more')).not.toBeInTheDocument();
282
+ expect(screen.queryByText('Show less')).not.toBeInTheDocument();
229
283
  });
230
- describe('fixedTypeUris behavior', function () {
284
+ describe('fixed type uris behavior', function () {
231
285
  var attrTypes = __spreadArray(__spreadArray([], attributesList, true), [EntityAttrTypes.roles, EntityAttrTypes.tags], false);
232
- var entity = {
233
- attributes: attributes,
234
- roles: ['configuraion/roles/123'],
235
- tags: ['tag1', 'tag2']
286
+ var metadata = {
287
+ entityTypes: [__assign(__assign({}, defaultMetadata.entityTypes[0]), { attributes: attrTypes })],
288
+ roles: [{ uri: 'configuration/roles/Pharmacy', label: 'Pharmacy', description: '' }]
236
289
  };
237
- it('should render ShowMore/ShowLess buttons and always show roles/tags if they have values', function () {
238
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attrTypes, entity: entity, parentUri: parentUri, drawLines: true, max: 1 }));
239
- var pagers = component.find(ReadOnlyAttributesPager);
240
- expect(pagers.length).toBe(3);
241
- expect(pagers.at(0).prop('attributeType')).toEqual(attrTypes[0]);
242
- expect(pagers.at(0).prop('values')).toEqual(attributes.Role);
243
- expect(pagers.at(1).prop('attributeType')).toEqual(EntityAttrTypes.roles);
244
- expect(pagers.at(1).prop('values')).toEqual(entity.roles);
245
- expect(pagers.at(2).prop('attributeType')).toEqual(EntityAttrTypes.tags);
246
- expect(pagers.at(2).prop('values')).toEqual(entity.tags);
247
- var showMoreButton = component.find(ShowMore);
248
- var showLessButton = component.find(ShowLess);
249
- expect(showMoreButton.length).toBe(1);
250
- expect(showLessButton.length).toBe(0);
251
- showMoreButton.prop('onClick')();
252
- rerenderWrapper(component);
253
- pagers = component.find(ReadOnlyAttributesPager);
254
- expect(pagers.length).toBe(4);
255
- expect(pagers.at(0).prop('attributeType')).toEqual(attrTypes[0]);
256
- expect(pagers.at(0).prop('values')).toEqual(attributes.Role);
257
- expect(pagers.at(1).prop('attributeType')).toEqual(attrTypes[1]);
258
- expect(pagers.at(1).prop('values')).toEqual(attributes.Name);
259
- expect(pagers.at(2).prop('attributeType')).toEqual(EntityAttrTypes.roles);
260
- expect(pagers.at(2).prop('values')).toEqual(entity.roles);
261
- expect(pagers.at(3).prop('attributeType')).toEqual(EntityAttrTypes.tags);
262
- expect(pagers.at(3).prop('values')).toEqual(entity.tags);
263
- showLessButton = component.find(ShowLess);
264
- showMoreButton = component.find(ShowMore);
265
- expect(showLessButton.length).toBe(1);
266
- expect(showMoreButton.length).toBe(0);
267
- showLessButton.prop('onClick')();
268
- rerenderWrapper(component);
269
- pagers = component.find(ReadOnlyAttributesPager);
270
- expect(pagers.length).toBe(3);
271
- expect(pagers.at(0).prop('attributeType')).toEqual(attrTypes[0]);
272
- expect(pagers.at(0).prop('values')).toEqual(attributes.Role);
273
- expect(pagers.at(1).prop('attributeType')).toEqual(EntityAttrTypes.roles);
274
- expect(pagers.at(1).prop('values')).toEqual(entity.roles);
275
- expect(pagers.at(2).prop('attributeType')).toEqual(EntityAttrTypes.tags);
276
- expect(pagers.at(2).prop('values')).toEqual(entity.tags);
277
- });
278
- it('should not render ShowMore and ShowLess', function () {
279
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attrTypes, entity: entity, parentUri: parentUri, drawLines: true }));
280
- var pager = component.find(ReadOnlyAttributesPager);
281
- expect(pager.length).toBe(4);
282
- var showMoreButton = component.find(ShowMore);
283
- var showLessButton = component.find(ShowLess);
284
- expect(showMoreButton.length).toBe(0);
285
- expect(showLessButton.length).toBe(0);
290
+ var entity = __assign(__assign({}, defaultEntity), { roles: ['configuration/roles/Pharmacy'], tags: ['tag1', 'tag2'] });
291
+ it('should render show more/show less buttons and always show roles/tags if they have values', function () { return __awaiter(void 0, void 0, void 0, function () {
292
+ var props, mdmValues, user, labels;
293
+ return __generator(this, function (_a) {
294
+ switch (_a.label) {
295
+ case 0:
296
+ props = __assign(__assign({}, defaultProps), { attrTypes: attrTypes, entity: entity, max: 1 });
297
+ mdmValues = { entity: entity, metadata: metadata };
298
+ user = setUp({ props: props, mdmValues: mdmValues }).user;
299
+ labels = screen.getAllByTestId('reltio-attribute-label');
300
+ expect(labels).toHaveLength(3);
301
+ expect(labels[0]).toHaveTextContent('Role');
302
+ expect(labels[1]).toHaveTextContent('Roles');
303
+ expect(labels[2]).toHaveTextContent('Tags');
304
+ return [4 /*yield*/, user.click(screen.getByText('Show more'))];
305
+ case 1:
306
+ _a.sent();
307
+ labels = screen.getAllByTestId('reltio-attribute-label');
308
+ expect(labels).toHaveLength(4);
309
+ expect(labels[0]).toHaveTextContent('Role');
310
+ expect(labels[1]).toHaveTextContent('Name');
311
+ expect(labels[2]).toHaveTextContent('Roles');
312
+ expect(labels[3]).toHaveTextContent('Tags');
313
+ return [4 /*yield*/, user.click(screen.getByText('Show less'))];
314
+ case 2:
315
+ _a.sent();
316
+ labels = screen.getAllByTestId('reltio-attribute-label');
317
+ expect(labels).toHaveLength(3);
318
+ expect(labels[0]).toHaveTextContent('Role');
319
+ expect(labels[1]).toHaveTextContent('Roles');
320
+ expect(labels[2]).toHaveTextContent('Tags');
321
+ return [2 /*return*/];
322
+ }
323
+ });
324
+ }); });
325
+ it('should not render show more and show less', function () {
326
+ var props = __assign(__assign({}, defaultProps), { attrTypes: attrTypes, entity: entity });
327
+ var mdmValues = { entity: entity, metadata: metadata };
328
+ setUp({ props: props, mdmValues: mdmValues });
329
+ expect(screen.queryByText('Show more')).not.toBeInTheDocument();
330
+ expect(screen.queryByText('Show less')).not.toBeInTheDocument();
286
331
  });
287
- it('should not render ShowMore and ShowLess when total count of items is lower than max', function () {
288
- var component = shallow(React.createElement(ReadOnlyAttributesList, { attrTypes: attrTypes, entity: entity, parentUri: parentUri, drawLines: true, max: 4 }));
289
- var pager = component.find(ReadOnlyAttributesPager);
290
- expect(pager.length).toBe(4);
291
- var showMoreButton = component.find(ShowMore);
292
- var showLessButton = component.find(ShowLess);
293
- expect(showMoreButton.length).toBe(0);
294
- expect(showLessButton.length).toBe(0);
332
+ it('should not render show more and show less when total count of items is lower than max', function () {
333
+ var props = __assign(__assign({}, defaultProps), { attrTypes: attrTypes, entity: entity, max: 4 });
334
+ var mdmValues = { entity: entity, metadata: metadata };
335
+ setUp({ props: props, mdmValues: mdmValues });
336
+ expect(screen.queryByText('Show more')).not.toBeInTheDocument();
337
+ expect(screen.queryByText('Show less')).not.toBeInTheDocument();
295
338
  });
296
339
  });
297
340
  });
@@ -5,7 +5,7 @@ export var attributesList = [
5
5
  type: 'String',
6
6
  hidden: false,
7
7
  required: false,
8
- uri: 'configuration/relationTypes/knowledge/attributes/Role',
8
+ uri: 'configuration/entityTypes/HCP/attributes/Role',
9
9
  lookupCode: 'rdm/lookupTypes/Role_knowledge',
10
10
  access: ['CREATE', 'READ', 'INITIATE_CHANGE_REQUEST', 'UPDATE']
11
11
  },
@@ -15,7 +15,7 @@ export var attributesList = [
15
15
  type: 'String',
16
16
  hidden: false,
17
17
  required: true,
18
- uri: 'configuration/relationTypes/knowledge/attributes/Name',
18
+ uri: 'configuration/entityTypes/HCP/attributes/Name',
19
19
  access: ['CREATE', 'READ', 'INITIATE_CHANGE_REQUEST', 'UPDATE']
20
20
  },
21
21
  {
@@ -24,14 +24,14 @@ export var attributesList = [
24
24
  type: 'String',
25
25
  hidden: true,
26
26
  required: false,
27
- uri: 'configuration/relationTypes/knowledge/attributes/LastName',
27
+ uri: 'configuration/entityTypes/HCP/attributes/LastName',
28
28
  access: ['CREATE', 'READ', 'INITIATE_CHANGE_REQUEST', 'UPDATE']
29
29
  },
30
30
  {
31
31
  name: 'Required',
32
32
  type: 'String',
33
33
  required: true,
34
- uri: 'configuration/relationTypes/knowledge/attributes/Required',
34
+ uri: 'configuration/entityTypes/HCP/attributes/Required',
35
35
  access: ['CREATE', 'READ', 'INITIATE_CHANGE_REQUEST', 'UPDATE']
36
36
  }
37
37
  ];