@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
@@ -10,260 +10,251 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
13
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
51
  };
16
52
  Object.defineProperty(exports, "__esModule", { value: true });
17
53
  var react_1 = __importDefault(require("react"));
18
- var enzyme_1 = require("enzyme");
19
- var test_utils_1 = require("react-dom/test-utils");
54
+ var react_2 = require("@testing-library/react");
55
+ var user_event_1 = __importDefault(require("@testing-library/user-event"));
20
56
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
21
- var Typography_1 = __importDefault(require("@mui/material/Typography"));
22
57
  var ReadOnlyComplexAttribute_1 = require("./ReadOnlyComplexAttribute");
23
- var ReadOnlyAttributesList_1 = require("../ReadOnlyAttributesList");
24
- var ArrowExpandButton_1 = require("../ArrowExpandButton");
25
58
  var nestedAttrType_test_data_1 = require("./nestedAttrType.test-data");
26
59
  var nestedAttrValue_test_data_1 = require("./nestedAttrValue.test-data");
27
- var classnames_1 = require("../constants/classnames");
28
- var CommentsContainer_1 = require("../CommentsContainer");
29
60
  var HighlightedValuesContext_1 = require("../contexts/HighlightedValuesContext");
30
- describe('ReadOnlyComplexAttribute', function () {
31
- var findExpandButton = function (component) { return component.find(ArrowExpandButton_1.ArrowExpandButton); };
32
- var findLabel = function (component) { return component.find(Typography_1.default); };
33
- var defaultProps = {
34
- label: 'ComplexAttribute Label',
35
- attributeType: nestedAttrType_test_data_1.nestedAttributeType,
36
- attributeValue: nestedAttrValue_test_data_1.nestedAttributeValue,
37
- attributeTypesList: nestedAttrType_test_data_1.nestedAttributeType.attributes
61
+ var CollaborationContext_1 = require("../contexts/CollaborationContext");
62
+ var collaboration = { commentsMap: {} };
63
+ var defaultHighlightedValues = {
64
+ highlightedValuesUris: [],
65
+ highlightedClassName: ''
66
+ };
67
+ var defaultProps = {
68
+ label: 'Complex attribute label',
69
+ attributeType: nestedAttrType_test_data_1.nestedAttributeType,
70
+ attributeValue: nestedAttrValue_test_data_1.nestedAttributeValue,
71
+ attributeTypesList: nestedAttrType_test_data_1.nestedAttributeType.attributes
72
+ };
73
+ var setUp = function (_a) {
74
+ var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.highlightedValues, highlightedValues = _d === void 0 ? defaultHighlightedValues : _d;
75
+ var user = user_event_1.default.setup();
76
+ var Providers = function (_a) {
77
+ var children = _a.children;
78
+ return (react_1.default.createElement(HighlightedValuesContext_1.HighlightedValuesContext.Provider, { value: highlightedValues },
79
+ react_1.default.createElement(CollaborationContext_1.CollaborationContext.Provider, { value: collaboration }, children)));
38
80
  };
81
+ return __assign(__assign({}, (0, react_2.render)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, props)), { wrapper: Providers })), { user: user });
82
+ };
83
+ describe('read only complex attribute tests', function () {
39
84
  afterEach(function () {
40
85
  jest.clearAllMocks();
41
86
  });
42
87
  it('should render expand button and label', function () {
43
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps)));
44
- expect(findExpandButton(component).length).toBe(1);
45
- var label = findLabel(component);
46
- expect(label.length).toBe(1);
47
- expect(label.text()).toBe(defaultProps.label);
48
- expect(component.find(ReadOnlyAttributesList_1.ReadOnlyAttributesList).length).toBe(0);
88
+ setUp();
89
+ react_2.screen.getByText('Complex attribute label');
90
+ react_2.screen.getByTestId('arrow-expand-button');
49
91
  });
50
92
  it('should render highlighted label', function () {
51
- var highlightedValuesContextValues = {
93
+ var highlightedValues = {
52
94
  highlightedValuesUris: ['relations/sIeHttl/attributes/AdditionalAttributes/2zoXFFwDl'],
53
- highlightedClassName: 'hlClassName'
95
+ highlightedClassName: 'highlightedClassName'
54
96
  };
55
- var component = (0, enzyme_1.mount)(react_1.default.createElement(HighlightedValuesContext_1.HighlightedValuesContext.Provider, { value: highlightedValuesContextValues },
56
- react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps))));
57
- var label = findLabel(component);
58
- expect(label.hasClass('hlClassName')).toBeTruthy();
97
+ setUp({ highlightedValues: highlightedValues });
98
+ expect(react_2.screen.getByText('Complex attribute label')).toHaveClass('highlightedClassName');
59
99
  });
60
- it('should render label without highlights if HighlightedValuesContext.Provider.highlightedValuesContextValues contains subattributes', function () {
61
- var highlightedValuesContextValues = {
100
+ it('should render label without highlights if highlighted values contains subattributes', function () {
101
+ var highlightedValues = {
62
102
  highlightedValuesUris: [
63
103
  'relations/sIeHttl/attributes/AdditionalAttributes/2zoXFFwDl/SubNested/gdggfgfgdf/SubSubNested/1'
64
104
  ],
65
- highlightedClassName: 'hlClassName'
105
+ highlightedClassName: 'highlightedClassName'
66
106
  };
67
- var component = (0, enzyme_1.mount)(react_1.default.createElement(HighlightedValuesContext_1.HighlightedValuesContext.Provider, { value: highlightedValuesContextValues },
68
- react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps))));
69
- var label = findLabel(component);
70
- expect(label.hasClass('hlClassName')).toBeFalsy();
107
+ setUp({ highlightedValues: highlightedValues });
108
+ expect(react_2.screen.getByText('Complex attribute label')).not.toHaveClass('highlightedClassName');
71
109
  });
72
110
  it('should render label without highlights', function () {
73
- var highlightedValuesContextValues = {
111
+ var highlightedValues = {
74
112
  highlightedValuesUris: ['relations/sIeHttl/attributes/AdditionalAttributes/2zoXFFwD'],
75
- highlightedClassName: 'hlClassName'
113
+ highlightedClassName: 'highlightedClassName'
76
114
  };
77
- var component = (0, enzyme_1.mount)(react_1.default.createElement(HighlightedValuesContext_1.HighlightedValuesContext.Provider, { value: highlightedValuesContextValues },
78
- react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps))));
79
- var label = findLabel(component);
80
- expect(label.hasClass('hlClassName')).toBeFalsy();
115
+ setUp({ highlightedValues: highlightedValues });
116
+ expect(react_2.screen.getByText('Complex attribute label')).not.toHaveClass('highlightedClassName');
81
117
  });
82
- it('should render ReadOnlyAttributesList after click on expand button', function () {
83
- var props = __assign({}, defaultProps);
84
- var children = react_1.default.createElement("span", null, "children");
85
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, props), children));
86
- expect(component.find(ReadOnlyAttributesList_1.ReadOnlyAttributesList).length).toBe(0);
87
- findExpandButton(component).prop('onClick')();
88
- var attributesList = component.find(ReadOnlyAttributesList_1.ReadOnlyAttributesList);
89
- expect(attributesList.length).toBe(1);
90
- expect(attributesList.prop('children')).toBe(children);
91
- });
92
- it('should set correct props for ReadOnlyAttributesList', function () {
93
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps)));
94
- findExpandButton(component).prop('onClick')();
95
- var attributesList = component.find(ReadOnlyAttributesList_1.ReadOnlyAttributesList);
96
- expect(attributesList.length).toBe(1);
97
- expect(attributesList.props()).toMatchObject({
98
- parentUri: defaultProps.attributeValue.uri,
99
- drawLines: true,
100
- attrTypes: defaultProps.attributeType.attributes,
101
- entity: {
102
- attributes: defaultProps.attributeValue.value
118
+ it('should render read only attributes list after click on expand button', function () { return __awaiter(void 0, void 0, void 0, function () {
119
+ var user, getLastExpandButton;
120
+ return __generator(this, function (_a) {
121
+ switch (_a.label) {
122
+ case 0:
123
+ user = setUp().user;
124
+ getLastExpandButton = function () {
125
+ var buttons = react_2.screen.getAllByTestId('arrow-expand-button');
126
+ return buttons[buttons.length - 1];
127
+ };
128
+ react_2.screen.getByText('Complex attribute label');
129
+ return [4 /*yield*/, user.click(getLastExpandButton())];
130
+ case 1:
131
+ _a.sent();
132
+ react_2.screen.getByText('Sub Nested');
133
+ react_2.screen.getByText('SubNested 1 Label');
134
+ return [4 /*yield*/, user.click(getLastExpandButton())];
135
+ case 2:
136
+ _a.sent();
137
+ react_2.screen.getByText('Sub Sub Nested');
138
+ react_2.screen.getByText('SubSubNested 1 Label');
139
+ return [4 /*yield*/, user.click(getLastExpandButton())];
140
+ case 3:
141
+ _a.sent();
142
+ react_2.screen.getByText('Attribute Value');
143
+ react_2.screen.getByText('12321');
144
+ return [2 /*return*/];
103
145
  }
104
146
  });
105
- });
106
- it('should set "entity" prop of ReadOnlyAttributesList correctly for special attributes', function () {
107
- var props = {
108
- label: 'Crosswalks',
109
- attributeType: {
110
- uri: 'crosswalks',
111
- type: 'Nested',
112
- attributes: Object.values(mdm_sdk_1.CrosswalksAttrTypes)
113
- },
114
- attributeValue: {
115
- uri: '1',
116
- value: {
117
- value: 'value',
118
- count: 5,
119
- reltioLoadDate: 123456775
120
- }
121
- },
122
- attributeTypesList: Object.values(mdm_sdk_1.CrosswalksAttrTypes)
123
- };
124
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, props)));
125
- findExpandButton(component).prop('onClick')();
126
- var attributesList = component.find(ReadOnlyAttributesList_1.ReadOnlyAttributesList);
127
- expect(attributesList.length).toBe(1);
128
- expect(attributesList.props()).toMatchObject({
129
- parentUri: props.attributeValue.uri,
130
- drawLines: true,
131
- attrTypes: props.attributeType.attributes,
132
- entity: __assign({ attributes: props.attributeValue.value }, props.attributeValue.value)
133
- });
134
- });
135
- var expandSubNesteds = function (component) {
136
- (0, test_utils_1.act)(function () {
137
- findExpandButton(component).prop('onClick')();
138
- });
139
- component.update();
140
- var complexes = component.find(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute);
141
- expect(complexes.length).toBe(2);
142
- var subComplex = complexes.at(1);
143
- (0, test_utils_1.act)(function () {
144
- findExpandButton(subComplex).prop('onClick')();
145
- });
146
- component.update();
147
- complexes = component.find(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute);
148
- expect(complexes.length).toBe(3);
149
- var subSubComplex = complexes.at(2);
150
- (0, test_utils_1.act)(function () {
151
- findExpandButton(subSubComplex).prop('onClick')();
147
+ }); });
148
+ it('should render special attributes correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
149
+ var props, user, specialRenderers;
150
+ return __generator(this, function (_a) {
151
+ switch (_a.label) {
152
+ case 0:
153
+ props = {
154
+ label: 'Crosswalks',
155
+ attributeType: {
156
+ uri: 'crosswalks',
157
+ type: 'Nested',
158
+ name: 'crosswalks',
159
+ attributes: Object.values(mdm_sdk_1.CrosswalksAttrTypes)
160
+ },
161
+ attributeValue: {
162
+ uri: '1',
163
+ value: {
164
+ value: 'value',
165
+ count: 5,
166
+ reltioLoadDate: 123456775
167
+ }
168
+ },
169
+ attributeTypesList: Object.values(mdm_sdk_1.CrosswalksAttrTypes)
170
+ };
171
+ user = setUp({ props: props }).user;
172
+ return [4 /*yield*/, user.click(react_2.screen.getByTestId('arrow-expand-button'))];
173
+ case 1:
174
+ _a.sent();
175
+ specialRenderers = react_2.screen.getAllByTestId('special-renderer');
176
+ expect(specialRenderers).toHaveLength(3);
177
+ expect(specialRenderers[0]).toHaveTextContent('ID Value');
178
+ expect(specialRenderers[0]).toHaveTextContent('value');
179
+ expect(specialRenderers[1]).toHaveTextContent('Crosswalk Count');
180
+ expect(specialRenderers[1]).toHaveTextContent('5');
181
+ expect(specialRenderers[2]).toHaveTextContent('Reltio Load Date');
182
+ expect(specialRenderers[2]).toHaveTextContent('01/02/1970 10:17:36 AM');
183
+ return [2 /*return*/];
184
+ }
152
185
  });
153
- component.update();
154
- };
155
- it('should render deep nested attributes', function () {
156
- var component = (0, enzyme_1.mount)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps)));
157
- expect(component.find(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute).length).toBe(1);
158
- expandSubNesteds(component);
159
- expect(component.find(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute).length).toBe(3);
160
- var deepComplex = component.find(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute).at(2);
161
- expect(deepComplex.prop('attributeValue')).toBe(defaultProps.attributeValue.value.SubNested[0].value.SubSubNested[0]);
162
- expect(deepComplex.prop('attributeTypesList')).toBe(defaultProps.attributeType.attributes[0].attributes[0].attributes);
163
- });
164
- it('should render analytics attributes correctly', function () {
165
- var nestedAnalyticsAttributeType = {
166
- label: 'Nested',
167
- name: 'Nested',
168
- type: 'Nested',
169
- uri: 'configuration/entityTypes/Type/analyticsAttributes/Nested',
170
- analyticsAttributes: [
171
- {
172
- label: 'String',
173
- name: 'String',
174
- type: 'String',
175
- uri: 'configuration/entityTypes/Type/analyticsAttributes/Nested/analyticsAttributes/String'
176
- }
177
- ]
178
- };
179
- var nestedAttributeValue = {
180
- label: 'Nested Label',
181
- value: {
182
- String: [
183
- {
184
- type: 'configuration/entityTypes/Type/analyticsAttributes/Nested/analyticsAttributes/String',
186
+ }); });
187
+ it('should render analytics attributes correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
188
+ var attributeType, attributeValue, props, user;
189
+ return __generator(this, function (_a) {
190
+ switch (_a.label) {
191
+ case 0:
192
+ attributeType = {
193
+ label: 'Nested',
194
+ name: 'Nested',
195
+ type: 'Nested',
196
+ uri: 'configuration/entityTypes/Type/analyticsAttributes/Nested',
197
+ analyticsAttributes: [
198
+ {
199
+ label: 'String',
200
+ name: 'String',
201
+ type: 'String',
202
+ uri: 'configuration/entityTypes/Type/analyticsAttributes/Nested/analyticsAttributes/String'
203
+ }
204
+ ]
205
+ };
206
+ attributeValue = {
207
+ label: 'Nested Label',
208
+ value: {
209
+ String: [
210
+ {
211
+ type: 'configuration/entityTypes/Type/analyticsAttributes/Nested/analyticsAttributes/String',
212
+ ov: true,
213
+ value: '12321',
214
+ uri: 'entities/sIeHttl/attributes/Nested/2zoXFFwDl/String/gdggfgfgdf'
215
+ }
216
+ ]
217
+ },
185
218
  ov: true,
186
- value: '12321',
187
- uri: 'entities/sIeHttl/attributes/Nested/2zoXFFwDl/String/gdggfgfgdf'
188
- }
189
- ]
190
- },
191
- ov: true,
192
- uri: 'entities/sIeHttl/attributes/Nested/2zoXFFwDl'
193
- };
194
- var component = (0, enzyme_1.mount)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, { label: "test", attributeType: nestedAnalyticsAttributeType, attributeValue: nestedAttributeValue, attributeTypesList: nestedAnalyticsAttributeType.analyticsAttributes }));
195
- expect(component.find(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute).length).toBe(1);
196
- (0, test_utils_1.act)(function () {
197
- findExpandButton(component).prop('onClick')();
198
- });
199
- component.update();
200
- var complex = component.find(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute);
201
- var attributesList = complex.find(ReadOnlyAttributesList_1.ReadOnlyAttributesList);
202
- expect(attributesList.prop('entity')).toEqual({
203
- analyticsAttributes: nestedAttributeValue.value,
204
- attributes: null
205
- });
206
- expect(attributesList.prop('attrTypes')).toBe(nestedAnalyticsAttributeType.analyticsAttributes);
207
- });
208
- it('should render CommentsContainer inside COMMENTS_CONTAINER_VISIBILITY_AREA with correct uri', function () {
209
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps)));
210
- var commentsContainer = component
211
- .find(".labelContainer.".concat(classnames_1.COMMENTS_CONTAINER_VISIBILITY_AREA))
212
- .find(CommentsContainer_1.CommentsContainer);
213
- expect(commentsContainer.length).toBe(1);
214
- expect(commentsContainer.prop('uri')).toBe(nestedAttrValue_test_data_1.nestedAttributeValue.uri);
215
- expect(commentsContainer.prop('relatedObjectUris')).toEqual(['relations/sIeHttl']);
216
- expect(commentsContainer.prop('objectType')).toBe(mdm_sdk_1.CollaborationObjectTypes.RELATION_ATTRIBUTE);
217
- component.setProps({
218
- attributeValue: __assign(__assign({}, nestedAttrValue_test_data_1.nestedAttributeValue), { uri: 'entities/123/attributes/Reference/r123/AdditionalAttributes/2zoXFFwDl' })
219
+ uri: 'entities/sIeHttl/attributes/Nested/2zoXFFwDl'
220
+ };
221
+ props = {
222
+ label: 'test',
223
+ attributeType: attributeType,
224
+ attributeValue: attributeValue,
225
+ attributeTypesList: attributeType.analyticsAttributes
226
+ };
227
+ user = setUp({ props: props }).user;
228
+ return [4 /*yield*/, user.click(react_2.screen.getByTestId('arrow-expand-button'))];
229
+ case 1:
230
+ _a.sent();
231
+ react_2.screen.getByText('test');
232
+ react_2.screen.getByText('String');
233
+ react_2.screen.getByText('12321');
234
+ return [2 /*return*/];
235
+ }
219
236
  });
220
- commentsContainer = component.find(CommentsContainer_1.CommentsContainer);
221
- expect(commentsContainer.prop('relatedObjectUris')).toEqual(['entities/123']);
222
- expect(commentsContainer.prop('objectType')).toBe(mdm_sdk_1.CollaborationObjectTypes.ENTITY_ATTRIBUTE);
237
+ }); });
238
+ it('should render custom label instead of label and comments container if "LabelRenderer" prop is defined', function () {
239
+ var props = __assign(__assign({}, defaultProps), { LabelRenderer: function () { return react_1.default.createElement("div", null, "Custom label"); } });
240
+ setUp({ props: props });
241
+ react_2.screen.getByText('Custom label');
242
+ expect(react_2.screen.queryByText('Complex attribute label')).not.toBeInTheDocument();
223
243
  });
224
- it('should render LabelRenderer instead of label and CommentsContainer if "LabelRenderer" prop is defined', function () {
225
- var LabelRenderer = function () { return react_1.default.createElement("span", null); };
226
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps, { LabelRenderer: LabelRenderer })));
227
- expect(findExpandButton(component).length).toBe(1);
228
- expect(findLabel(component).length).toBe(0);
229
- expect(component.find(CommentsContainer_1.CommentsContainer).length).toBe(0);
230
- var labelRenderer = component.find(LabelRenderer);
231
- expect(labelRenderer.length).toBe(1);
232
- expect(labelRenderer.prop('attributeType')).toBe(defaultProps.attributeType);
233
- expect(labelRenderer.prop('attributeValue')).toBe(defaultProps.attributeValue);
234
- });
235
- it('should render RightSlot if "RightSlot" prop is defined', function () {
236
- var RightSlot = function () { return react_1.default.createElement("span", null); };
237
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps, { RightSlot: RightSlot })));
238
- expect(findExpandButton(component).length).toBe(1);
239
- expect(findLabel(component).length).toBe(1);
240
- expect(component.find(CommentsContainer_1.CommentsContainer).length).toBe(1);
241
- var rightSlot = component.find(RightSlot);
242
- expect(rightSlot.length).toBe(1);
243
- expect(rightSlot.prop('attributeType')).toBe(defaultProps.attributeType);
244
- expect(rightSlot.prop('attributeValue')).toBe(defaultProps.attributeValue);
245
- });
246
- it('should set correct props for CommentsContainer component if we have entity attribute', function () {
247
- var attributeType = {
248
- uri: 'configuration/entityTypes/HCA/attributes/ContactPreference',
249
- type: 'Nested',
250
- name: 'ContactPreference',
251
- label: 'Contact Preference'
252
- };
253
- var attributeValue = {
254
- uri: 'entities/1Gw3QsjR/attributes/Affiliations/pdVWCxm/ContactPreference/14wY5z5Nr',
255
- value: {},
256
- ov: true
257
- };
258
- var props = __assign(__assign({}, defaultProps), { attributeType: attributeType, attributeValue: attributeValue });
259
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, props)));
260
- var commentsContainer = component.find(CommentsContainer_1.CommentsContainer);
261
- expect(commentsContainer.prop('relatedObjectUris')).toEqual(['entities/1Gw3QsjR']);
262
- expect(commentsContainer.prop('objectType')).toBe(mdm_sdk_1.CollaborationObjectTypes.ENTITY_ATTRIBUTE);
244
+ it('should render right slot if "RightSlot" prop is defined', function () {
245
+ var props = __assign(__assign({}, defaultProps), { RightSlot: function () { return react_1.default.createElement("div", null, "Right slot"); } });
246
+ setUp({ props: props });
247
+ react_2.screen.getByText('Complex attribute label');
248
+ react_2.screen.getByText('Right slot');
263
249
  });
264
250
  it('should add ovFalse style for attribute', function () {
265
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyComplexAttribute_1.ReadOnlyComplexAttribute, __assign({}, defaultProps, { attributeValue: __assign(__assign({}, nestedAttrValue_test_data_1.nestedAttributeValue), { ov: false }) })));
266
- var label = findLabel(component);
267
- expect(label.hasClass('ovFalse')).toBe(true);
251
+ var attributeValue = __assign(__assign({}, nestedAttrValue_test_data_1.nestedAttributeValue), { ov: false });
252
+ var props = __assign(__assign({}, defaultProps), { attributeValue: attributeValue });
253
+ setUp({ props: props });
254
+ expect(react_2.screen.getByText('Complex attribute label')).toHaveClass('ovFalse');
255
+ });
256
+ it('should render comments container', function () {
257
+ setUp();
258
+ react_2.screen.getByLabelText('Add comment');
268
259
  });
269
260
  });