@reltio/components 1.4.2044 → 1.4.2046

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 (175) hide show
  1. package/AttributesFiltersBuilder/AttributesFiltersBuilder.test.js +72 -50
  2. package/BasicTable/BasicTable.test.js +232 -278
  3. package/BlobRenderer/BlobRenderer.js +1 -1
  4. package/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.test.js +125 -111
  5. package/DateIntervalSelector/DateIntervalSelector.test.js +87 -65
  6. package/DefaultCellValueRenderer/DefaultCellValueRenderer.js +1 -1
  7. package/DefaultCellValueRenderer/DefaultCellValueRenderer.test.js +16 -46
  8. package/DeleteButton/DeleteButton.spec.js +53 -15
  9. package/DependentLookupEditor/DependentLookupEditor.test.js +555 -807
  10. package/Drawer/Drawer.test.js +9 -20
  11. package/DropDownEditor/DropDownEditor.test.js +81 -29
  12. package/DropDownMenuButton/DropDownMenuButton.spec.js +101 -70
  13. package/DropDownSelector/DropDownSelector.test.js +159 -30
  14. package/EditModeAttributesFactory/EditModeAttributesFactory.test.js +143 -0
  15. package/EditModeAttributesList/EditModeAttributesList.test.js +277 -224
  16. package/EditModeAttributesList/attributes.test-data.d.ts +0 -11
  17. package/EditModeAttributesList/attributes.test-data.js +1 -1
  18. package/EditModeAttributesPager/EditModeAttributesPager.test.js +698 -234
  19. package/EditModeAttributesPager/helpers.test.js +2 -12
  20. package/EditModeAttributesView/EditModeAttributesView.test.js +263 -157
  21. package/EditModeComplexAttribute/EditModeComplexAttribute.js +1 -1
  22. package/EditModeComplexAttribute/EditModeComplexAttribute.test.js +313 -298
  23. package/EditModeComplexAttribute/nestedAttrType.test-data.d.ts +0 -5
  24. package/EditModeComplexAttribute/nestedAttrType.test-data.js +3 -44
  25. package/EmptyState/EmptyState.test.js +99 -38
  26. package/EntityCreator/EntityCreator.test.js +68 -35
  27. package/EntitySelector/EntitySelector.js +1 -1
  28. package/EntitySelector/EntitySelector.test.js +275 -422
  29. package/EntityTypeIcon/EntityTypeIcon.test.js +16 -16
  30. package/EntityTypesSelector/EntityTypesSelector.test.js +62 -21
  31. package/ErrorBoundary/ErrorBoundary.test.js +19 -17
  32. package/ErrorMessage/ErrorMessage.js +1 -1
  33. package/ErrorPopup/ErrorPopup.test.js +72 -25
  34. package/ErrorWrapper/ErrorWrapper.test.js +10 -9
  35. package/ExpandedValueTooltip/ExpandedValueTooltip.test.js +111 -37
  36. package/FileTypeEditor/FileTypeEditor.test.js +95 -64
  37. package/FilterValueEditor/FilterValueEditor.test.js +183 -157
  38. package/FilterValueEditor/components/RangeDataTypeValueEditor/RangeDataTypeValueEditor.js +2 -2
  39. package/HierarchicalAttributeTooltip/HierarchicalAttributeTooltip.test.js +114 -24
  40. package/HierarchyNodeTitle/HierarchyNodeTitle.test.js +61 -100
  41. package/OvIcon/OvIcon.js +2 -2
  42. package/ProfileCard/components/ProfileCardPlaceholder/ProfileCardPlaceholder.js +2 -2
  43. package/ShowLess/ShowLess.js +1 -1
  44. package/SimpleAttributeEditor/SimpleAttributeEditor.js +2 -2
  45. package/UploadFileButton/components/UploadMode/UploadMode.js +1 -1
  46. package/cjs/AttributesFiltersBuilder/AttributesFiltersBuilder.test.js +72 -50
  47. package/cjs/BasicTable/BasicTable.test.js +230 -299
  48. package/cjs/BlobRenderer/BlobRenderer.js +1 -1
  49. package/cjs/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.test.js +125 -111
  50. package/cjs/DateIntervalSelector/DateIntervalSelector.test.js +87 -65
  51. package/cjs/DefaultCellValueRenderer/DefaultCellValueRenderer.js +1 -1
  52. package/cjs/DefaultCellValueRenderer/DefaultCellValueRenderer.test.js +16 -46
  53. package/cjs/DeleteButton/DeleteButton.spec.js +53 -15
  54. package/cjs/DependentLookupEditor/DependentLookupEditor.test.js +569 -821
  55. package/cjs/Drawer/Drawer.test.js +10 -21
  56. package/cjs/DropDownEditor/DropDownEditor.test.js +81 -29
  57. package/cjs/DropDownMenuButton/DropDownMenuButton.spec.js +102 -71
  58. package/cjs/DropDownSelector/DropDownSelector.test.js +159 -30
  59. package/cjs/EditModeAttributesFactory/EditModeAttributesFactory.test.js +148 -0
  60. package/cjs/EditModeAttributesList/EditModeAttributesList.test.js +277 -224
  61. package/cjs/EditModeAttributesList/attributes.test-data.d.ts +0 -11
  62. package/cjs/EditModeAttributesList/attributes.test-data.js +1 -1
  63. package/cjs/EditModeAttributesPager/EditModeAttributesPager.test.js +696 -232
  64. package/cjs/EditModeAttributesPager/helpers.test.js +2 -12
  65. package/cjs/EditModeAttributesView/EditModeAttributesView.test.js +262 -156
  66. package/cjs/EditModeComplexAttribute/EditModeComplexAttribute.js +1 -1
  67. package/cjs/EditModeComplexAttribute/EditModeComplexAttribute.test.js +312 -297
  68. package/cjs/EditModeComplexAttribute/nestedAttrType.test-data.d.ts +0 -5
  69. package/cjs/EditModeComplexAttribute/nestedAttrType.test-data.js +3 -44
  70. package/cjs/EmptyState/EmptyState.test.js +98 -37
  71. package/cjs/EntityCreator/EntityCreator.test.js +69 -36
  72. package/cjs/EntitySelector/EntitySelector.js +1 -1
  73. package/cjs/EntitySelector/EntitySelector.test.js +274 -421
  74. package/cjs/EntityTypeIcon/EntityTypeIcon.test.js +17 -17
  75. package/cjs/EntityTypesSelector/EntityTypesSelector.test.js +62 -21
  76. package/cjs/ErrorBoundary/ErrorBoundary.test.js +19 -17
  77. package/cjs/ErrorMessage/ErrorMessage.js +1 -1
  78. package/cjs/ErrorPopup/ErrorPopup.test.js +71 -24
  79. package/cjs/ErrorWrapper/ErrorWrapper.test.js +10 -9
  80. package/cjs/ExpandedValueTooltip/ExpandedValueTooltip.test.js +111 -37
  81. package/cjs/FileTypeEditor/FileTypeEditor.test.js +95 -64
  82. package/cjs/FilterValueEditor/FilterValueEditor.test.js +182 -156
  83. package/cjs/FilterValueEditor/components/RangeDataTypeValueEditor/RangeDataTypeValueEditor.js +2 -2
  84. package/cjs/HierarchicalAttributeTooltip/HierarchicalAttributeTooltip.test.js +114 -24
  85. package/cjs/HierarchyNodeTitle/HierarchyNodeTitle.test.js +61 -100
  86. package/cjs/OvIcon/OvIcon.js +2 -2
  87. package/cjs/ProfileCard/components/ProfileCardPlaceholder/ProfileCardPlaceholder.js +2 -2
  88. package/cjs/ShowLess/ShowLess.js +1 -1
  89. package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.js +2 -2
  90. package/cjs/UploadFileButton/components/UploadMode/UploadMode.js +1 -1
  91. package/cjs/contexts/ExpandedAttributesContext/useAttributeExpanded.test.js +25 -18
  92. package/cjs/contexts/MdmModuleContext/hooks.d.ts +2 -2
  93. package/cjs/contexts/ReloadDataContext/ReloadDataContext.spec.js +16 -53
  94. package/cjs/test-utils/TestStylesProvider.js +6 -5
  95. package/contexts/ExpandedAttributesContext/useAttributeExpanded.test.js +25 -18
  96. package/contexts/MdmModuleContext/hooks.d.ts +2 -2
  97. package/contexts/ReloadDataContext/ReloadDataContext.spec.js +16 -30
  98. package/package.json +2 -2
  99. package/test-utils/TestStylesProvider.js +3 -2
  100. package/AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.test.js +0 -101
  101. package/AttributesFiltersBuilder/components/RowActions/RowActions.test.js +0 -106
  102. package/BasicTable/IntegrationBasicTable.test.d.ts +0 -1
  103. package/BasicTable/IntegrationBasicTable.test.js +0 -203
  104. package/DependentLookupEditor/IntegrationDependentLookupEditor.test.d.ts +0 -1
  105. package/DependentLookupEditor/IntegrationDependentLookupEditor.test.js +0 -137
  106. package/DropDownMenuButton/components/DefaultMenuItemRenderer/DefaultMenuItemRenderer.spec.d.ts +0 -1
  107. package/DropDownMenuButton/components/DefaultMenuItemRenderer/DefaultMenuItemRenderer.spec.js +0 -32
  108. package/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.d.ts +0 -1
  109. package/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js +0 -106
  110. package/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.test.d.ts +0 -1
  111. package/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.test.js +0 -338
  112. package/EditModeAttributesPager/components/AttributeRenderer/IntegrationAttributeRenderer.test.d.ts +0 -1
  113. package/EditModeAttributesPager/components/AttributeRenderer/IntegrationAttributeRenderer.test.js +0 -225
  114. package/EditModeAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
  115. package/EditModeAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -47
  116. package/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
  117. package/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -204
  118. package/EditModeAttributesView/IntegrationEditModeAttributesView.test.d.ts +0 -1
  119. package/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +0 -246
  120. package/EditModeAttributesView/metadata.test-data.d.ts +0 -4
  121. package/EditModeAttributesView/metadata.test-data.js +0 -119
  122. package/EntityCreator/entityType.test-data.d.ts +0 -52
  123. package/EntityCreator/entityType.test-data.js +0 -188
  124. package/EntitySelector/components/ClearIndicator/ClearIndicator.test.d.ts +0 -1
  125. package/EntitySelector/components/ClearIndicator/ClearIndicator.test.js +0 -27
  126. package/EntitySelector/components/EntityOption/EntityOption.test.d.ts +0 -1
  127. package/EntitySelector/components/EntityOption/EntityOption.test.js +0 -79
  128. package/EntitySelector/components/Group/Group.test.d.ts +0 -1
  129. package/EntitySelector/components/Group/Group.test.js +0 -65
  130. package/EntitySelector/components/SingleValue/SingleValue.test.d.ts +0 -1
  131. package/EntitySelector/components/SingleValue/SingleValue.test.js +0 -78
  132. package/FilterValueEditor/components/RangeDataTypeValueEditor/RangeDataTypeValueEditor.test.d.ts +0 -1
  133. package/FilterValueEditor/components/RangeDataTypeValueEditor/RangeDataTypeValueEditor.test.js +0 -76
  134. package/cjs/AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.test.d.ts +0 -1
  135. package/cjs/AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.test.js +0 -106
  136. package/cjs/AttributesFiltersBuilder/components/RowActions/RowActions.test.d.ts +0 -1
  137. package/cjs/AttributesFiltersBuilder/components/RowActions/RowActions.test.js +0 -111
  138. package/cjs/BasicTable/IntegrationBasicTable.test.d.ts +0 -1
  139. package/cjs/BasicTable/IntegrationBasicTable.test.js +0 -208
  140. package/cjs/DependentLookupEditor/IntegrationDependentLookupEditor.test.d.ts +0 -1
  141. package/cjs/DependentLookupEditor/IntegrationDependentLookupEditor.test.js +0 -142
  142. package/cjs/DropDownMenuButton/components/DefaultMenuItemRenderer/DefaultMenuItemRenderer.spec.d.ts +0 -1
  143. package/cjs/DropDownMenuButton/components/DefaultMenuItemRenderer/DefaultMenuItemRenderer.spec.js +0 -37
  144. package/cjs/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.d.ts +0 -1
  145. package/cjs/EditModeAttributesFactory/components/EditModeAttribute/EditModeAttribute.test.js +0 -111
  146. package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.test.d.ts +0 -1
  147. package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.test.js +0 -343
  148. package/cjs/EditModeAttributesPager/components/AttributeRenderer/IntegrationAttributeRenderer.test.d.ts +0 -1
  149. package/cjs/EditModeAttributesPager/components/AttributeRenderer/IntegrationAttributeRenderer.test.js +0 -230
  150. package/cjs/EditModeAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
  151. package/cjs/EditModeAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -52
  152. package/cjs/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
  153. package/cjs/EditModeAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -209
  154. package/cjs/EditModeAttributesView/IntegrationEditModeAttributesView.test.d.ts +0 -1
  155. package/cjs/EditModeAttributesView/IntegrationEditModeAttributesView.test.js +0 -251
  156. package/cjs/EditModeAttributesView/metadata.test-data.d.ts +0 -4
  157. package/cjs/EditModeAttributesView/metadata.test-data.js +0 -123
  158. package/cjs/EntityCreator/entityType.test-data.d.ts +0 -52
  159. package/cjs/EntityCreator/entityType.test-data.js +0 -191
  160. package/cjs/EntitySelector/components/ClearIndicator/ClearIndicator.test.d.ts +0 -1
  161. package/cjs/EntitySelector/components/ClearIndicator/ClearIndicator.test.js +0 -32
  162. package/cjs/EntitySelector/components/EntityOption/EntityOption.test.d.ts +0 -1
  163. package/cjs/EntitySelector/components/EntityOption/EntityOption.test.js +0 -84
  164. package/cjs/EntitySelector/components/Group/Group.test.d.ts +0 -1
  165. package/cjs/EntitySelector/components/Group/Group.test.js +0 -70
  166. package/cjs/EntitySelector/components/SingleValue/SingleValue.test.d.ts +0 -1
  167. package/cjs/EntitySelector/components/SingleValue/SingleValue.test.js +0 -83
  168. package/cjs/FilterValueEditor/components/RangeDataTypeValueEditor/RangeDataTypeValueEditor.test.d.ts +0 -1
  169. package/cjs/FilterValueEditor/components/RangeDataTypeValueEditor/RangeDataTypeValueEditor.test.js +0 -81
  170. package/cjs/contexts/CollaborationContext/CollaborationContextProvider.test.d.ts +0 -1
  171. package/cjs/contexts/CollaborationContext/CollaborationContextProvider.test.js +0 -104
  172. package/contexts/CollaborationContext/CollaborationContextProvider.test.d.ts +0 -1
  173. package/contexts/CollaborationContext/CollaborationContextProvider.test.js +0 -99
  174. /package/{AttributesFiltersBuilder/components/AttributeSelector/AttributeSelector.test.d.ts → EditModeAttributesFactory/EditModeAttributesFactory.test.d.ts} +0 -0
  175. /package/{AttributesFiltersBuilder/components/RowActions/RowActions.test.d.ts → cjs/EditModeAttributesFactory/EditModeAttributesFactory.test.d.ts} +0 -0
@@ -20,12 +20,7 @@ export declare const nestedAttributeType: {
20
20
  name: string;
21
21
  type: string;
22
22
  uri: string;
23
- skipInDataAccess: boolean;
24
- access: string[];
25
23
  }[];
26
- access: string[];
27
24
  }[];
28
- access: string[];
29
25
  }[];
30
- access: string[];
31
26
  };
@@ -8,29 +8,8 @@ var subSubNestedAttributeType = {
8
8
  label: 'Attribute Value',
9
9
  name: 'AttributeValue',
10
10
  type: 'String',
11
- uri: 'configuration/relationTypes/InternalHCPtoHCP/attributes/AdditionalAttributes/attributes/SubNested/attributes/SubSubNested/attributes/AttributeValue',
12
- skipInDataAccess: false,
13
- access: [
14
- 'CREATE',
15
- 'UPDATE',
16
- 'DELETE',
17
- 'READ',
18
- 'UNMERGE',
19
- 'INITIATE_CHANGE_REQUEST',
20
- 'MERGE',
21
- 'ACCEPT_CHANGE_REQUEST'
22
- ]
11
+ uri: 'configuration/relationTypes/InternalHCPtoHCP/attributes/AdditionalAttributes/attributes/SubNested/attributes/SubSubNested/attributes/AttributeValue'
23
12
  }
24
- ],
25
- access: [
26
- 'CREATE',
27
- 'UPDATE',
28
- 'DELETE',
29
- 'READ',
30
- 'UNMERGE',
31
- 'INITIATE_CHANGE_REQUEST',
32
- 'MERGE',
33
- 'ACCEPT_CHANGE_REQUEST'
34
13
  ]
35
14
  };
36
15
  var subNestedAttributeType = {
@@ -39,17 +18,7 @@ var subNestedAttributeType = {
39
18
  type: 'Nested',
40
19
  dataLabelPattern: '{AttributeName} [+ {AttributeType}] [+ {AttributeValue}]',
41
20
  uri: 'configuration/relationTypes/InternalHCPtoHCP/attributes/AdditionalAttributes/attributes/SubNested',
42
- attributes: [subSubNestedAttributeType],
43
- access: [
44
- 'CREATE',
45
- 'UPDATE',
46
- 'DELETE',
47
- 'READ',
48
- 'UNMERGE',
49
- 'INITIATE_CHANGE_REQUEST',
50
- 'MERGE',
51
- 'ACCEPT_CHANGE_REQUEST'
52
- ]
21
+ attributes: [subSubNestedAttributeType]
53
22
  };
54
23
  export var nestedAttributeType = {
55
24
  label: 'Additional Attributes',
@@ -57,15 +26,5 @@ export var nestedAttributeType = {
57
26
  type: 'Nested',
58
27
  uri: 'configuration/relationTypes/InternalHCPtoHCP/attributes/AdditionalAttributes',
59
28
  dataLabelPattern: '{AttributeName} [- {AttributeType}] [- {AttributeValue}]',
60
- attributes: [subNestedAttributeType],
61
- access: [
62
- 'CREATE',
63
- 'UPDATE',
64
- 'DELETE',
65
- 'READ',
66
- 'UNMERGE',
67
- 'INITIATE_CHANGE_REQUEST',
68
- 'MERGE',
69
- 'ACCEPT_CHANGE_REQUEST'
70
- ]
29
+ attributes: [subNestedAttributeType]
71
30
  };
@@ -1,45 +1,106 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
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
+ };
1
48
  import React from 'react';
2
- import { mount } from 'enzyme';
3
- import Button from '@mui/material/Button';
4
- import { EmptyState } from './EmptyState';
5
- var Logo = function () { return React.createElement("div", null); };
6
- describe('EmptyState tests', function () {
49
+ import { render, screen } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
51
+ import { EMPTY_STATE_VARIANTS, EmptyState } from './EmptyState';
52
+ var defaultProps = {
53
+ text: 'Header',
54
+ variant: EMPTY_STATE_VARIANTS.full,
55
+ LogoRenderer: function () { return React.createElement("div", { "data-reltio-id": "logo" }); }
56
+ };
57
+ var setUp = function (props) {
58
+ if (props === void 0) { props = defaultProps; }
59
+ var user = userEvent.setup();
60
+ return __assign({ user: user }, render(React.createElement(EmptyState, __assign({}, props))));
61
+ };
62
+ describe('Empty state tests', function () {
7
63
  it('should render main parts', function () {
8
- var text = 'Header';
9
- var component = mount(React.createElement(EmptyState, { access: false, LogoRenderer: Logo, text: text }));
10
- expect(component.find(Logo)).toHaveLength(1);
11
- expect(component.find('.textBox')).toHaveLength(1);
12
- expect(component.find('.text')).toHaveLength(2);
13
- expect(component.find('.text').at(0).text()).toBe(text);
14
- expect(component.find('.secondaryText')).toHaveLength(0);
15
- expect(component.find(Button)).toHaveLength(0);
64
+ setUp(__assign(__assign({}, defaultProps), { access: false }));
65
+ screen.getByTestId('logo');
66
+ screen.getByText('Header');
67
+ expect(screen.queryByText('Description')).not.toBeInTheDocument();
68
+ expect(screen.queryByRole('button')).not.toBeInTheDocument();
16
69
  });
17
70
  it('should render secondaryText if it is defined', function () {
18
- var secondaryText = 'Description';
19
- var component = mount(React.createElement(EmptyState, { access: false, LogoRenderer: Logo, text: "Header", secondaryText: secondaryText }));
20
- expect(component.find(Logo)).toHaveLength(1);
21
- expect(component.find('.textBox')).toHaveLength(1);
22
- expect(component.find('.text')).toHaveLength(2);
23
- expect(component.find('.secondaryText')).toHaveLength(2);
24
- expect(component.find('.secondaryText').at(0).text()).toBe(secondaryText);
25
- expect(component.find(Button)).toHaveLength(0);
26
- });
27
- it('should render Button component if buttonTitle is defined and has access', function () {
28
- var buttonTitle = 'SELECT';
29
- var component = mount(React.createElement(EmptyState, { access: true, LogoRenderer: Logo, text: "Header", buttonTitle: buttonTitle }));
30
- expect(component.find(Logo)).toHaveLength(1);
31
- expect(component.find('.textBox')).toHaveLength(1);
32
- expect(component.find(Button)).toHaveLength(1);
33
- expect(component.find(Button).text()).toBe(buttonTitle);
34
- });
35
- it('should call onClick on button click', function () {
36
- var onClick = jest.fn();
37
- var component = mount(React.createElement(EmptyState, { access: true, LogoRenderer: Logo, text: "Header", buttonTitle: 'SELECT', onClick: onClick }));
38
- component.find(Button).find('button').at(0).simulate('click');
39
- expect(onClick).toHaveBeenCalled();
71
+ setUp(__assign(__assign({}, defaultProps), { secondaryText: 'Description' }));
72
+ screen.getByText('Description');
40
73
  });
41
- it('should not fail when onClick prop is undefined', function () {
42
- var component = mount(React.createElement(EmptyState, { access: true, LogoRenderer: Logo, text: "Header", buttonTitle: 'SELECT' }));
43
- component.find(Button).find('button').at(0).simulate('click');
74
+ it('should render button component if buttonTitle is defined and has access', function () {
75
+ setUp(__assign(__assign({}, defaultProps), { access: true, buttonTitle: 'SELECT' }));
76
+ expect(screen.getByRole('button', { name: 'SELECT' })).toBeInTheDocument();
44
77
  });
78
+ it('should call onClick on button click', function () { return __awaiter(void 0, void 0, void 0, function () {
79
+ var onClick, user;
80
+ return __generator(this, function (_a) {
81
+ switch (_a.label) {
82
+ case 0:
83
+ onClick = jest.fn();
84
+ user = setUp(__assign(__assign({}, defaultProps), { access: true, buttonTitle: 'SELECT', onClick: onClick })).user;
85
+ return [4 /*yield*/, user.click(screen.getByRole('button', { name: 'SELECT' }))];
86
+ case 1:
87
+ _a.sent();
88
+ expect(onClick).toHaveBeenCalled();
89
+ return [2 /*return*/];
90
+ }
91
+ });
92
+ }); });
93
+ it('should not fail when onClick prop is undefined', function () { return __awaiter(void 0, void 0, void 0, function () {
94
+ var user;
95
+ return __generator(this, function (_a) {
96
+ switch (_a.label) {
97
+ case 0:
98
+ user = setUp(__assign(__assign({}, defaultProps), { access: true, buttonTitle: 'SELECT' })).user;
99
+ return [4 /*yield*/, user.click(screen.getByRole('button', { name: 'SELECT' }))];
100
+ case 1:
101
+ _a.sent();
102
+ return [2 /*return*/];
103
+ }
104
+ });
105
+ }); });
45
106
  });
@@ -11,23 +11,50 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  var _a;
13
13
  import React from 'react';
14
- import { mount } from 'enzyme';
15
14
  import { Mode } from '@reltio/mdm-sdk';
16
- import { EntityCreator } from './EntityCreator';
17
- import { entityType } from './entityType.test-data';
18
- import { EditModeAttributesList } from '../EditModeAttributesList';
15
+ import { render, screen, within } from '@testing-library/react';
16
+ import userEvent from '@testing-library/user-event';
19
17
  import { MdmModuleProvider } from '../contexts/MdmModuleContext';
20
- jest.mock('../EditModeAttributesList', function () { return ({
21
- EditModeAttributesList: function () { return null; }
22
- }); });
18
+ import { EntityCreator } from './EntityCreator';
19
+ var entityType = {
20
+ uri: 'configuration/entityTypes/HCP',
21
+ label: 'HCP',
22
+ attributes: [
23
+ {
24
+ label: 'String',
25
+ name: 'FirstName',
26
+ type: 'String',
27
+ uri: 'configuration/entityTypes/HCP/attributes/FirstName'
28
+ },
29
+ {
30
+ label: 'Enumeration',
31
+ name: 'Enumeration',
32
+ type: 'String',
33
+ uri: 'configuration/entityTypes/HCP/attributes/Enumeration'
34
+ },
35
+ {
36
+ label: 'Int',
37
+ name: 'Int',
38
+ type: 'Int',
39
+ uri: 'configuration/entityTypes/HCP/attributes/Int'
40
+ },
41
+ {
42
+ label: 'Float',
43
+ name: 'Float',
44
+ type: 'Float',
45
+ uri: 'configuration/entityTypes/HCP/attributes/Float'
46
+ }
47
+ ]
48
+ };
23
49
  var defaultEntityUri = 'entities/123';
24
50
  var defaultEntity = {
25
51
  uri: defaultEntityUri,
26
- attributes: { Attr1: [], Attr2: [] },
27
- crosswalks: [{}]
52
+ type: 'configuration/entityTypes/HCP',
53
+ attributes: { Attr1: [], Attr2: [] }
28
54
  };
29
55
  var defaultMdmValues = {
30
- modifiedEntities: (_a = {}, _a[defaultEntityUri] = defaultEntity, _a)
56
+ modifiedEntities: (_a = {}, _a[defaultEntityUri] = defaultEntity, _a),
57
+ dependentLookups: { editors: {}, structure: {}, initedTypeUris: [] }
31
58
  };
32
59
  var mdmActions = {
33
60
  addAttributes: jest.fn(),
@@ -37,39 +64,45 @@ var mdmActions = {
37
64
  var defaultProps = {
38
65
  entityType: entityType,
39
66
  entityUri: defaultEntityUri,
40
- mode: Mode.Viewing
67
+ mode: Mode.Editing
41
68
  };
42
69
  var setUp = function (_a) {
43
70
  var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
44
- return mount(React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions },
45
- React.createElement(EntityCreator, __assign({}, props))));
71
+ var user = userEvent.setup();
72
+ var Providers = function (_a) {
73
+ var children = _a.children;
74
+ return (React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions }, children));
75
+ };
76
+ return __assign(__assign({}, render(React.createElement(EntityCreator, __assign({}, props)), { wrapper: Providers })), { user: user });
46
77
  };
47
- describe('EntityCreator', function () {
78
+ describe('Entity сreator tests', function () {
48
79
  it('should render nothing if entity is null', function () {
49
80
  var props = __assign(__assign({}, defaultProps), { entityUri: 'entities/234234232' });
50
- var component = setUp({ props: props });
51
- expect(component.find(EditModeAttributesList).length).toBe(0);
81
+ var container = setUp({ props: props }).container;
82
+ expect(container).toBeEmptyDOMElement();
52
83
  });
53
- it('should render AttributeList with correct props if entity is not null', function () {
54
- var component = setUp();
55
- var attributeList = component.find(EditModeAttributesList);
56
- expect(attributeList.length).toBe(1);
57
- expect(attributeList.key()).toBe(defaultEntityUri);
58
- expect(attributeList.prop('attrTypes')).toEqual(entityType.attributes);
59
- expect(attributeList.prop('entity')).toBe(defaultEntity);
60
- expect(attributeList.prop('showEmptyEditors')).toBe(true);
61
- expect(attributeList.prop('drawLines')).toBe(true);
62
- expect(attributeList.prop('parentUri')).toBe(defaultEntityUri);
63
- expect(attributeList.prop('mode')).toBe(defaultProps.mode);
64
- expect(attributeList.prop('crosswalks')).toBe(defaultEntity.crosswalks);
65
- expect(attributeList.prop('onAddAttributes')).toBe(mdmActions.addAttributes);
66
- expect(attributeList.prop('onChangeAttribute')).toBe(mdmActions.modifyAttribute);
67
- expect(attributeList.prop('onDeleteAttribute')).toBe(mdmActions.removeAttribute);
84
+ it('should render correctly if entity is not null', function () {
85
+ setUp();
86
+ var branchDecorators = screen.getAllByTestId('branch-decorator');
87
+ expect(branchDecorators).toHaveLength(5);
88
+ within(branchDecorators[0]).getByText('More attributes');
89
+ within(branchDecorators[1]).getByText('String');
90
+ within(branchDecorators[1]).getByRole('textbox');
91
+ within(branchDecorators[2]).getByText('Enumeration');
92
+ within(branchDecorators[2]).getByRole('textbox');
93
+ within(branchDecorators[3]).getByText('Int');
94
+ within(branchDecorators[3]).getByRole('textbox');
95
+ within(branchDecorators[4]).getByText('Float');
96
+ within(branchDecorators[4]).getByRole('textbox');
68
97
  });
69
- it('should use attributeTypesSelectionStrategy for evaluating needed attribute types for AttributeList', function () {
98
+ it('should use attributeTypesSelectionStrategy for evaluating needed attribute types correctly', function () {
70
99
  var props = __assign(__assign({}, defaultProps), { attributeTypesSelectionStrategy: function (entityType) { return entityType.attributes.slice(0, 2); } });
71
- var component = setUp({ props: props });
72
- var attributeList = component.find(EditModeAttributesList);
73
- expect(attributeList.prop('attrTypes')).toEqual(props.entityType.attributes.slice(0, 2));
100
+ setUp({ props: props });
101
+ var branchDecorators = screen.getAllByTestId('branch-decorator');
102
+ expect(branchDecorators).toHaveLength(3);
103
+ within(branchDecorators[0]).getByText('More attributes');
104
+ within(branchDecorators[1]).getByText('String');
105
+ within(branchDecorators[1]).getByRole('textbox');
106
+ within(branchDecorators[2]).getByText('Enumeration');
74
107
  });
75
108
  });
@@ -75,6 +75,6 @@ export var EntitySelector = function (_a) {
75
75
  }, [TextFieldProps]);
76
76
  return (React.createElement(React.Fragment, null,
77
77
  React.createElement(DropDownSelector, __assign({ value: !isEmpty(entity) ? entity : undefined, inputValue: inputValue, onInputChange: handleInputChange, getOptions: getOptions, getOptionLabel: prop('entityLabel'), onChange: handleChange, onCreate: handleCreate, onClear: handleClear, label: label, createLabel: createLabel, components: __assign(__assign({ Option: EntityOption, SingleValue: SingleValue }, groupComponent), clearComponent), currentEntityType: currentEntityType, isClearable: true, disableLinkClick: disableLinkClick, TextFieldProps: textFieldProps }, dropDownSelectorProps)),
78
- isTempEntity && (React.createElement("div", { className: styles.creatorWrapper },
78
+ isTempEntity && (React.createElement("div", { "data-reltio-id": "entity-creator", className: styles.creatorWrapper },
79
79
  React.createElement(EntityCreator, { mode: mode, attributeTypesSelectionStrategy: attributeTypesSelectionStrategy, entityType: currentEntityType, entityUri: entity.entityUri })))));
80
80
  };