@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
@@ -51,14 +51,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
53
  var react_1 = __importDefault(require("react"));
54
- var enzyme_1 = require("enzyme");
55
- var test_utils_1 = require("react-dom/test-utils");
56
- var Tooltip_1 = __importDefault(require("@mui/material/Tooltip"));
57
- var PivotingTooltip_1 = require("./PivotingTooltip");
58
- var PivotingUriLink_1 = require("../PivotingUriLink");
54
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
55
+ var react_2 = require("@testing-library/react");
56
+ var user_event_1 = __importDefault(require("@testing-library/user-event"));
59
57
  var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
60
58
  var PivotingAttributeContext_1 = require("../contexts/PivotingAttributeContext");
61
- jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getFilteredEntities: jest.fn() })); });
59
+ var PivotingTooltip_1 = require("./PivotingTooltip");
60
+ jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { getFilteredEntities: jest.fn(), getTotals: jest.fn() })); });
61
+ var mdmActions = { openPivotingPerspective: jest.fn() };
62
62
  var attributes = [
63
63
  {
64
64
  name: 'Phone',
@@ -88,17 +88,46 @@ var attributes = [
88
88
  var metadata = {
89
89
  entityTypes: [
90
90
  {
91
- attributes: attributes,
92
91
  uri: 'configuration/entityTypes/HCP',
92
+ attributes: attributes,
93
93
  analyticsAttributes: []
94
+ },
95
+ {
96
+ uri: 'configuration/entityTypes/HCO',
97
+ attributes: []
94
98
  }
95
99
  ]
96
100
  };
97
- var uiPath = 'https://reltio.com/nui';
98
- var openPivotingPerspective = jest.fn();
101
+ var defaultMdmValues = {
102
+ metadata: metadata,
103
+ uiPath: 'https://reltio.com/nui',
104
+ globalFilter: {
105
+ query: "((equals(type,'configuration/entityTypes/HCP') and (range(updatedTime,1622458333452,1622717533451) or range(updatedTime,1622458333452,1622717533451))))",
106
+ savedSearches: [],
107
+ savedSearchesUris: []
108
+ },
109
+ entity: { uri: 'entityUri', type: 'configuration/entityTypes/HCP' }
110
+ };
111
+ var defaultProps = {
112
+ value: {
113
+ value: '8-800-555-35-35',
114
+ ov: true,
115
+ type: 'String',
116
+ lookupCode: '8-800-555-35-35',
117
+ lookupRawValue: '8-800-555-35-35',
118
+ uri: 'configuration/entityTypes/HCP/attributes/Phone'
119
+ },
120
+ attributeType: {
121
+ name: 'Phone',
122
+ uri: 'configuration/entityTypes/HCP/attributes/Phone',
123
+ type: 'String'
124
+ },
125
+ children: '8-800-555-35-35'
126
+ };
99
127
  var defaultPivotingAttributeContextValue = [
100
128
  {
101
- uri: 'configuration/entityTypes/HCP/attributes/Phone'
129
+ uri: 'configuration/entityTypes/HCP/attributes/Phone',
130
+ popup: { label: 'HCOs', entityType: 'configuration/entityTypes/HCO' }
102
131
  },
103
132
  {
104
133
  uri: 'configuration/entityTypes/HCP/attributes/Phone2',
@@ -108,183 +137,318 @@ var defaultPivotingAttributeContextValue = [
108
137
  uri: 'configuration/entityTypes/HCP/attributes/Phone3'
109
138
  }
110
139
  ];
111
- var setUp = function (props, pivotingAttributeContextValue) {
112
- if (pivotingAttributeContextValue === void 0) { pivotingAttributeContextValue = defaultPivotingAttributeContextValue; }
113
- return (0, enzyme_1.mount)(react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: { metadata: metadata, uiPath: uiPath }, actions: { openPivotingPerspective: openPivotingPerspective } },
140
+ var setUp = function (_a) {
141
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d, _e = _b.pivotingAttributeContextValue, pivotingAttributeContextValue = _e === void 0 ? defaultPivotingAttributeContextValue : _e;
142
+ var user = user_event_1.default.setup();
143
+ (0, react_2.render)(react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues, actions: mdmActions },
114
144
  react_1.default.createElement(PivotingAttributeContext_1.PivotingAttributeContext.Provider, { value: pivotingAttributeContextValue },
115
145
  react_1.default.createElement(PivotingTooltip_1.PivotingTooltip, __assign({}, props)))));
146
+ return { user: user };
116
147
  };
117
- describe('PivotingTooltip tests', function () {
118
- var values = {
119
- value: '8-800-555-35-35',
120
- ov: true,
121
- type: 'String',
122
- lookupCode: '8-800-555-35-35',
123
- lookupRawValue: '8-800-555-35-35'
124
- };
125
- it('should render Tooltip for simple attributes', function () {
126
- var value = __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone' });
127
- var attributeType = {
128
- name: 'Phone',
129
- uri: 'configuration/entityTypes/HCP/attributes/Phone',
130
- type: 'String'
148
+ describe('Pivoting tooltip test', function () {
149
+ beforeEach(function () {
150
+ var allEntities = [
151
+ { uri: 'entities/01Qi9Bv', type: 'configuration/entityTypes/HCP', label: 'hcp entity label 1' },
152
+ { uri: 'entities/ba7sAl2', type: 'configuration/entityTypes/HCP', label: 'hcp entity label 2' },
153
+ { uri: 'entities/Js28AmP', type: 'configuration/entityTypes/HCO', label: 'hco entity label 1' },
154
+ { uri: 'entities/NsmA10S', type: 'configuration/entityTypes/HCO', label: 'hco entity label 2' },
155
+ { uri: 'entities/Lk2Iq09', type: 'configuration/entityTypes/HCO', label: 'hco entity label 3' },
156
+ { uri: 'entities/jsAm291', type: 'configuration/entityTypes/HCO', label: 'hco entity label 4' },
157
+ { uri: 'entities/Nsb30A3', type: 'configuration/entityTypes/HCO', label: 'hco entity label 5' },
158
+ { uri: 'entities/Bsn13La', type: 'configuration/entityTypes/HCO', label: 'hco entity label 6' },
159
+ { uri: 'entities/JamdS14', type: 'configuration/entityTypes/HCO', label: 'hco entity label 7' }
160
+ ];
161
+ var getEntitites = function (_a) {
162
+ var values = _a.filters[0].values;
163
+ var entityType = values[0];
164
+ return allEntities.filter(function (_a) {
165
+ var type = _a.type;
166
+ return type === entityType;
167
+ });
131
168
  };
132
- var props = { value: value, attributeType: attributeType, children: '8-800-555-35-35' };
133
- var component = setUp(props);
134
- var tooltip = component.find(Tooltip_1.default);
135
- expect(tooltip.length).toBe(1);
136
- var title = tooltip.prop('title');
137
- expect(title.props.attributeType).toEqual(attributeType);
138
- expect(tooltip.prop('disableInteractive')).toBe(false);
169
+ mdm_sdk_1.getFilteredEntities.mockImplementation(getEntitites);
170
+ mdm_sdk_1.getTotals.mockImplementation(function (params) { return ({ total: getEntitites(params).length }); });
139
171
  });
140
- it('should not render Tooltip for simple attributes', function () {
141
- var value = __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone123' });
142
- var attributeType = {
143
- name: 'Phone',
144
- uri: 'configuration/entityTypes/HCP/attributes/Phone123',
145
- type: 'String'
146
- };
147
- var props = { value: value, attributeType: attributeType, children: '8-800-555-35-35' };
148
- var component = setUp(props);
149
- expect(component.find(Tooltip_1.default).length).toBe(0);
172
+ afterEach(function () {
173
+ jest.clearAllMocks();
150
174
  });
151
- it('should render Tooltip for nested attributes', function () {
152
- var value = {
153
- uri: 'configuration/entityTypes/HCP/attributes/Phone2',
154
- ov: true,
155
- value: {
156
- Phone3: [
157
- __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3' })
158
- ]
175
+ it('should render tooltip for simple attributes correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
176
+ var user, tooltip, popper, params;
177
+ return __generator(this, function (_a) {
178
+ switch (_a.label) {
179
+ case 0:
180
+ user = setUp().user;
181
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
182
+ case 1:
183
+ tooltip = _a.sent();
184
+ expect(mdm_sdk_1.getTotals).toHaveBeenCalledTimes(0);
185
+ expect(mdm_sdk_1.getFilteredEntities).toHaveBeenCalledTimes(0);
186
+ return [4 /*yield*/, user.hover(tooltip)];
187
+ case 2:
188
+ _a.sent();
189
+ popper = react_2.screen.getByRole('tooltip');
190
+ (0, react_2.within)(popper).getByText('Pivot profiles');
191
+ (0, react_2.within)(popper).getByText('7 items');
192
+ (0, react_2.within)(popper).getByText('HCOs');
193
+ (0, react_2.within)(popper).getByText('hco entity label 1');
194
+ (0, react_2.within)(popper).getByText('hco entity label 2');
195
+ (0, react_2.within)(popper).getByText('hco entity label 3');
196
+ (0, react_2.within)(popper).getByText('hco entity label 4');
197
+ (0, react_2.within)(popper).getByText('hco entity label 5');
198
+ (0, react_2.within)(popper).getByText('hco entity label 6');
199
+ (0, react_2.within)(popper).getByText('hco entity label 7');
200
+ (0, react_2.within)(popper).getByText('See all');
201
+ params = {
202
+ filters: [
203
+ { fieldName: 'type', filter: 'equals', values: ['configuration/entityTypes/HCO'] },
204
+ { fieldName: 'attributes.Phone', filter: 'equals', values: ['8-800-555-35-35'] }
205
+ ],
206
+ options: { globalFilter: defaultMdmValues.globalFilter.query, max: 6, searchOptions: '', sort: 'label' }
207
+ };
208
+ expect(mdm_sdk_1.getFilteredEntities).toHaveBeenCalledWith(params);
209
+ expect(mdm_sdk_1.getTotals).toHaveBeenCalledWith(params);
210
+ return [2 /*return*/];
159
211
  }
160
- };
161
- var props = { value: value, attributeType: attributes[0], children: '8-800-555-35-35' };
162
- var component = setUp(props);
163
- var tooltip = component.find(Tooltip_1.default);
164
- expect(tooltip.length).toBe(1);
165
- var title = tooltip.prop('title');
166
- expect(title.props.attributeType).toEqual(attributes[0]);
167
- });
168
- it('should not render Tooltip for nested attributes', function () {
169
- var value = {
170
- uri: 'configuration/entityTypes/HCP/attributes/Phone2555',
171
- ov: true,
172
- value: {
173
- Phone3: [
174
- __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3' })
175
- ]
212
+ });
213
+ }); });
214
+ it('should not render tooltip for simple attributes if it is not pivoting attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
215
+ var value, attributeType, props, user, _a, _b;
216
+ return __generator(this, function (_c) {
217
+ switch (_c.label) {
218
+ case 0:
219
+ value = __assign(__assign({}, defaultProps.value), { uri: 'configuration/entityTypes/HCP/attributes/Phone123' });
220
+ attributeType = __assign(__assign({}, defaultProps.attributeType), { uri: 'configuration/entityTypes/HCP/attributes/Phone123', name: 'Phone123' });
221
+ props = __assign(__assign({}, defaultProps), { value: value, attributeType: attributeType });
222
+ user = setUp({ props: props }).user;
223
+ _b = (_a = user).hover;
224
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
225
+ case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
226
+ case 2:
227
+ _c.sent();
228
+ expect(react_2.screen.queryByRole('tooltip')).not.toBeInTheDocument();
229
+ return [2 /*return*/];
176
230
  }
177
- };
178
- var attributeType = {
179
- name: 'Phone2',
180
- uri: 'configuration/entityTypes/HCP/attributes/Phone2555',
181
- type: 'Nested',
182
- attributes: [
183
- {
184
- uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3',
185
- name: 'Phone3',
186
- type: 'String'
187
- }
188
- ]
189
- };
190
- var props = { value: value, attributeType: attributeType, children: '8-800-555-35-35' };
191
- var component = setUp(props);
192
- expect(component.find(Tooltip_1.default).length).toBe(0);
193
- });
194
- it('should render Tooltip for nested attributes if children do not exist in config of pivoting', function () {
195
- var value = {
196
- uri: 'configuration/entityTypes/HCP/attributes/Phone3',
197
- ov: true,
198
- value: {
199
- Phone4: [
200
- __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone3/attributes/Phone4' })
201
- ]
231
+ });
232
+ }); });
233
+ it('should render tooltip for nested attributes correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
234
+ var value, props, user, tooltip, popper, params;
235
+ return __generator(this, function (_a) {
236
+ switch (_a.label) {
237
+ case 0:
238
+ value = {
239
+ uri: 'configuration/entityTypes/HCP/attributes/Phone2',
240
+ ov: true,
241
+ value: {
242
+ Phone3: [
243
+ {
244
+ value: '8-800-555-35-35',
245
+ ov: true,
246
+ type: 'String',
247
+ lookupCode: '8-800-555-35-35',
248
+ lookupRawValue: '8-800-555-35-35',
249
+ uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3'
250
+ }
251
+ ]
252
+ }
253
+ };
254
+ props = __assign(__assign({}, defaultProps), { value: value, attributeType: attributes[0] });
255
+ user = setUp({ props: props }).user;
256
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
257
+ case 1:
258
+ tooltip = _a.sent();
259
+ expect(mdm_sdk_1.getTotals).toHaveBeenCalledTimes(0);
260
+ expect(mdm_sdk_1.getFilteredEntities).toHaveBeenCalledTimes(0);
261
+ return [4 /*yield*/, user.hover(tooltip)];
262
+ case 2:
263
+ _a.sent();
264
+ popper = react_2.screen.getByRole('tooltip');
265
+ (0, react_2.within)(popper).getByText('Pivot profiles');
266
+ (0, react_2.within)(popper).getByText('2 items');
267
+ (0, react_2.within)(popper).getByText('hcp entity label 1');
268
+ (0, react_2.within)(popper).getByText('hcp entity label 2');
269
+ expect((0, react_2.within)(popper).queryByText('See all')).not.toBeInTheDocument();
270
+ params = {
271
+ filters: [
272
+ { fieldName: 'type', filter: 'equals', values: ['configuration/entityTypes/HCP'] },
273
+ { fieldName: 'attributes.Phone2.Phone3', filter: 'equals', values: ['8-800-555-35-35'] }
274
+ ],
275
+ options: { globalFilter: defaultMdmValues.globalFilter.query, max: 6, searchOptions: '', sort: 'label' }
276
+ };
277
+ expect(mdm_sdk_1.getFilteredEntities).toHaveBeenCalledWith(params);
278
+ expect(mdm_sdk_1.getTotals).toHaveBeenCalledWith(params);
279
+ return [2 /*return*/];
202
280
  }
203
- };
204
- var props = { value: value, attributeType: attributes[1], children: '8-800-555-35-35' };
205
- var component = setUp(props);
206
- var tooltip = component.find(Tooltip_1.default);
207
- expect(tooltip.length).toBe(1);
208
- var title = tooltip.prop('title');
209
- expect(title.props.attributeType).toEqual(attributes[1]);
210
- });
211
- it('should render PivotingTooltipContent with correct config', function () {
212
- var _a;
213
- var value = {
214
- uri: 'configuration/entityTypes/HCP/attributes/Phone2',
215
- ov: true,
216
- value: {
217
- Phone3: [
218
- __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3' })
219
- ]
281
+ });
282
+ }); });
283
+ it('should not render tooltip for nested attributes if it is not pivoting attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
284
+ var value, attributeType, props, user, _a, _b;
285
+ return __generator(this, function (_c) {
286
+ switch (_c.label) {
287
+ case 0:
288
+ value = {
289
+ uri: 'configuration/entityTypes/HCP/attributes/Phone4',
290
+ ov: true,
291
+ value: {
292
+ Phone3: [
293
+ {
294
+ value: '8-800-555-35-35',
295
+ ov: true,
296
+ type: 'String',
297
+ lookupCode: '8-800-555-35-35',
298
+ lookupRawValue: '8-800-555-35-35',
299
+ uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3'
300
+ }
301
+ ]
302
+ }
303
+ };
304
+ attributeType = __assign(__assign({}, attributes[0]), { name: 'Phone4', uri: 'configuration/entityTypes/HCP/attributes/Phone4' });
305
+ props = __assign(__assign({}, defaultProps), { value: value, attributeType: attributeType });
306
+ user = setUp({ props: props }).user;
307
+ _b = (_a = user).hover;
308
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
309
+ case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
310
+ case 2:
311
+ _c.sent();
312
+ expect(react_2.screen.queryByRole('tooltip')).not.toBeInTheDocument();
313
+ return [2 /*return*/];
220
314
  }
221
- };
222
- var pivotingAttributeContextValue = [
223
- __assign(__assign({}, defaultPivotingAttributeContextValue[1]), { popup: {
224
- label: 'HCOs',
225
- entityType: 'HCO'
226
- } })
227
- ];
228
- var props = { value: value, attributeType: attributes[0], children: '8-800-555-35-35' };
229
- var component = setUp(props, pivotingAttributeContextValue);
230
- var title = component.find(Tooltip_1.default).prop('title');
231
- expect(title.props.label).toEqual((_a = pivotingAttributeContextValue[0].popup) === null || _a === void 0 ? void 0 : _a.label);
232
- });
233
- it('should not fail if pivotingAttributesList is null', function () {
234
- var value = __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone' });
235
- var attributeType = {
236
- name: 'Phone',
237
- uri: 'configuration/entityTypes/HCP/attributes/Phone',
238
- type: 'String'
239
- };
240
- var props = { value: value, attributeType: attributeType, children: '8-800-555-35-35' };
241
- var component = setUp(props, null);
242
- var tooltip = component.find(Tooltip_1.default);
243
- expect(tooltip.length).toBe(0);
244
- });
245
- it('should open pivoting perspective on click for simple attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
246
- var value, attributeType, props, component;
247
- return __generator(this, function (_a) {
248
- value = __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone' });
249
- attributeType = {
250
- name: 'Phone',
251
- uri: 'configuration/entityTypes/HCP/attributes/Phone',
252
- type: 'String'
253
- };
254
- props = { value: value, attributeType: attributeType, children: '8-800-555-35-35' };
255
- component = setUp(props);
256
- (0, test_utils_1.act)(function () {
257
- component.find(PivotingUriLink_1.PivotingUriLink).prop('onClick')();
258
- });
259
- expect(openPivotingPerspective).toHaveBeenCalledWith({ value: [{ Phone: '8-800-555-35-35' }], attributeType: attributeType });
260
- return [2 /*return*/];
261
315
  });
262
316
  }); });
263
- it('should open pivoting perspective on click for nested attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
264
- var value, props, component, generatedValue;
317
+ it('should render tooltip for nested attributes if children do not exist in config of pivoting', function () { return __awaiter(void 0, void 0, void 0, function () {
318
+ var value, props, user, _a, _b, popper, params;
319
+ return __generator(this, function (_c) {
320
+ switch (_c.label) {
321
+ case 0:
322
+ value = {
323
+ uri: 'configuration/entityTypes/HCP/attributes/Phone3',
324
+ ov: true,
325
+ value: {
326
+ Phone4: [
327
+ {
328
+ value: '8-800-555-35-35',
329
+ ov: true,
330
+ type: 'String',
331
+ lookupCode: '8-800-555-35-35',
332
+ lookupRawValue: '8-800-555-35-35',
333
+ uri: 'configuration/entityTypes/HCP/attributes/Phone3/attributes/Phone4'
334
+ }
335
+ ]
336
+ }
337
+ };
338
+ props = __assign(__assign({}, defaultProps), { value: value, attributeType: attributes[1] });
339
+ user = setUp({ props: props }).user;
340
+ _b = (_a = user).hover;
341
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
342
+ case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
343
+ case 2:
344
+ _c.sent();
345
+ popper = react_2.screen.getByRole('tooltip');
346
+ (0, react_2.within)(popper).getByText('Pivot profiles');
347
+ (0, react_2.within)(popper).getByText('2 items');
348
+ (0, react_2.within)(popper).getByText('hcp entity label 1');
349
+ (0, react_2.within)(popper).getByText('hcp entity label 2');
350
+ expect((0, react_2.within)(popper).queryByText('See all')).not.toBeInTheDocument();
351
+ params = {
352
+ filters: [
353
+ { fieldName: 'type', filter: 'equals', values: ['configuration/entityTypes/HCP'] },
354
+ { fieldName: 'attributes.Phone3.Phone4', filter: 'equals', values: ['8-800-555-35-35'] }
355
+ ],
356
+ options: { globalFilter: defaultMdmValues.globalFilter.query, max: 6, searchOptions: '', sort: 'label' }
357
+ };
358
+ expect(mdm_sdk_1.getFilteredEntities).toHaveBeenCalledWith(params);
359
+ expect(mdm_sdk_1.getTotals).toHaveBeenCalledWith(params);
360
+ return [2 /*return*/];
361
+ }
362
+ });
363
+ }); });
364
+ it('should not fail if pivoting attributes list is null', function () { return __awaiter(void 0, void 0, void 0, function () {
265
365
  return __generator(this, function (_a) {
266
- value = {
267
- uri: 'configuration/entityTypes/HCP/attributes/Phone2',
268
- ov: true,
269
- value: {
270
- Phone3: [
271
- __assign(__assign({}, values), { uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3' })
272
- ]
273
- }
274
- };
275
- props = { value: value, attributeType: attributes[0], children: '8-800-555-35-35' };
276
- component = setUp(props);
277
- (0, test_utils_1.act)(function () {
278
- component.find(PivotingUriLink_1.PivotingUriLink).prop('onClick')();
279
- });
280
- generatedValue = [{ Phone3: ['8-800-555-35-35'] }];
281
- expect(openPivotingPerspective).toHaveBeenCalledWith({
282
- value: generatedValue,
283
- attributeType: attributes[0]
284
- });
285
- expect(component.find(PivotingUriLink_1.PivotingUriLink).prop('value')).toEqual(generatedValue);
286
- expect(component.find(PivotingUriLink_1.PivotingUriLink).prop('attributeType')).toEqual(attributes[0]);
287
- return [2 /*return*/];
366
+ switch (_a.label) {
367
+ case 0:
368
+ setUp({ pivotingAttributeContextValue: null });
369
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
370
+ case 1:
371
+ _a.sent();
372
+ return [2 /*return*/];
373
+ }
374
+ });
375
+ }); });
376
+ it('should open pivoting perspective on simple attribute click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
377
+ var user, _a, _b;
378
+ return __generator(this, function (_c) {
379
+ switch (_c.label) {
380
+ case 0:
381
+ user = setUp().user;
382
+ _b = (_a = user).click;
383
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
384
+ case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
385
+ case 2:
386
+ _c.sent();
387
+ expect(mdmActions.openPivotingPerspective).toHaveBeenCalledWith({
388
+ attributeType: defaultProps.attributeType,
389
+ value: [{ Phone: '8-800-555-35-35' }]
390
+ });
391
+ return [2 /*return*/];
392
+ }
393
+ });
394
+ }); });
395
+ it('should open pivoting perspective on nested attribute click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
396
+ var value, attributeType, props, user, _a, _b;
397
+ return __generator(this, function (_c) {
398
+ switch (_c.label) {
399
+ case 0:
400
+ value = {
401
+ uri: 'configuration/entityTypes/HCP/attributes/Phone2',
402
+ ov: true,
403
+ value: {
404
+ Phone3: [
405
+ {
406
+ value: '8-800-555-35-35',
407
+ ov: true,
408
+ type: 'String',
409
+ lookupCode: '8-800-555-35-35',
410
+ lookupRawValue: '8-800-555-35-35',
411
+ uri: 'configuration/entityTypes/HCP/attributes/Phone2/attributes/Phone3'
412
+ }
413
+ ]
414
+ }
415
+ };
416
+ attributeType = attributes[0];
417
+ props = __assign(__assign({}, defaultProps), { value: value, attributeType: attributeType });
418
+ user = setUp({ props: props }).user;
419
+ _b = (_a = user).click;
420
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
421
+ case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
422
+ case 2:
423
+ _c.sent();
424
+ expect(mdmActions.openPivotingPerspective).toHaveBeenCalledWith({
425
+ attributeType: attributeType,
426
+ value: [{ Phone3: ['8-800-555-35-35'] }]
427
+ });
428
+ return [2 /*return*/];
429
+ }
430
+ });
431
+ }); });
432
+ it('should open pivoting perspective on see all button click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
433
+ var user, _a, _b;
434
+ return __generator(this, function (_c) {
435
+ switch (_c.label) {
436
+ case 0:
437
+ user = setUp().user;
438
+ _b = (_a = user).hover;
439
+ return [4 /*yield*/, react_2.screen.findByText('8-800-555-35-35')];
440
+ case 1: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
441
+ case 2:
442
+ _c.sent();
443
+ return [4 /*yield*/, user.click(react_2.screen.getByText('See all'))];
444
+ case 3:
445
+ _c.sent();
446
+ expect(mdmActions.openPivotingPerspective).toHaveBeenCalledWith({
447
+ attributeType: defaultProps.attributeType,
448
+ value: [{ Phone: '8-800-555-35-35' }]
449
+ });
450
+ return [2 /*return*/];
451
+ }
288
452
  });
289
453
  }); });
290
454
  });