@reltio/components 1.4.1998 → 1.4.2000

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 (178) hide show
  1. package/cjs/UpSetChart/UpSetChart.d.ts +5 -8
  2. package/cjs/UpSetChart/UpSetChart.js +61 -5
  3. package/cjs/UpSetChart/UpSetChart.test.js +198 -0
  4. package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
  5. package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +66 -0
  6. package/cjs/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
  7. package/cjs/UpSetChart/components/IntersectionsChart/index.js +5 -0
  8. package/cjs/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
  9. package/cjs/UpSetChart/components/IntersectionsChart/styles.js +32 -0
  10. package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
  11. package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +64 -0
  12. package/cjs/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
  13. package/cjs/UpSetChart/components/IntersectionsChartAxis/index.js +5 -0
  14. package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
  15. package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.js +32 -0
  16. package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
  17. package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +56 -0
  18. package/cjs/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
  19. package/cjs/UpSetChart/components/IntersectionsMatrix/index.js +5 -0
  20. package/cjs/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
  21. package/cjs/UpSetChart/components/IntersectionsMatrix/styles.js +27 -0
  22. package/cjs/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
  23. package/cjs/UpSetChart/components/SetsChart/SetsChart.js +58 -0
  24. package/cjs/UpSetChart/components/SetsChart/index.d.ts +1 -0
  25. package/cjs/UpSetChart/components/SetsChart/index.js +5 -0
  26. package/cjs/UpSetChart/components/SetsChart/styles.d.ts +1 -0
  27. package/cjs/UpSetChart/components/SetsChart/styles.js +43 -0
  28. package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
  29. package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +20 -0
  30. package/cjs/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
  31. package/cjs/UpSetChart/components/SetsChartAxis/index.js +5 -0
  32. package/cjs/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
  33. package/cjs/UpSetChart/components/SetsChartAxis/styles.js +17 -0
  34. package/cjs/UpSetChart/constants.d.ts +16 -3
  35. package/cjs/UpSetChart/constants.js +20 -4
  36. package/cjs/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
  37. package/cjs/UpSetChart/gameOfThrones.test-data.js +26 -0
  38. package/cjs/UpSetChart/helpers.d.ts +20 -0
  39. package/cjs/UpSetChart/helpers.js +127 -0
  40. package/cjs/UpSetChart/styles.d.ts +4 -1
  41. package/cjs/UpSetChart/styles.js +11 -12
  42. package/cjs/UpSetChart/types.d.ts +16 -0
  43. package/cjs/UpSetChart/types.js +2 -0
  44. package/cjs/UpSetChart/useUpSetChartSizes.d.ts +20 -0
  45. package/cjs/UpSetChart/useUpSetChartSizes.js +34 -0
  46. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +36 -0
  47. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +288 -0
  48. package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +708 -370
  49. package/cjs/features/crosswalks/ColoredBlock/ColoredBlock.test.js +77 -15
  50. package/cjs/features/crosswalks/CopyableValueField/CopyableValueField.test.js +85 -15
  51. package/cjs/features/crosswalks/CrosswalkAttributes/CrosswalkAttributes.test.js +265 -193
  52. package/cjs/features/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.test.js +106 -12
  53. package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +21 -9
  54. package/cjs/features/crosswalks/CrosswalkEditor/CrosswalkEditor.test.js +190 -90
  55. package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +323 -225
  56. package/cjs/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +75 -12
  57. package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +171 -138
  58. package/esm/UpSetChart/UpSetChart.d.ts +5 -8
  59. package/esm/UpSetChart/UpSetChart.js +38 -5
  60. package/esm/UpSetChart/UpSetChart.test.js +193 -0
  61. package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
  62. package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +39 -0
  63. package/esm/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
  64. package/esm/UpSetChart/components/IntersectionsChart/index.js +1 -0
  65. package/esm/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
  66. package/esm/UpSetChart/components/IntersectionsChart/styles.js +29 -0
  67. package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
  68. package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +34 -0
  69. package/esm/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
  70. package/esm/UpSetChart/components/IntersectionsChartAxis/index.js +1 -0
  71. package/esm/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
  72. package/esm/UpSetChart/components/IntersectionsChartAxis/styles.js +29 -0
  73. package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
  74. package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +26 -0
  75. package/esm/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
  76. package/esm/UpSetChart/components/IntersectionsMatrix/index.js +1 -0
  77. package/esm/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
  78. package/esm/UpSetChart/components/IntersectionsMatrix/styles.js +24 -0
  79. package/esm/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
  80. package/esm/UpSetChart/components/SetsChart/SetsChart.js +31 -0
  81. package/esm/UpSetChart/components/SetsChart/index.d.ts +1 -0
  82. package/esm/UpSetChart/components/SetsChart/index.js +1 -0
  83. package/esm/UpSetChart/components/SetsChart/styles.d.ts +1 -0
  84. package/esm/UpSetChart/components/SetsChart/styles.js +40 -0
  85. package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
  86. package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +13 -0
  87. package/esm/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
  88. package/esm/UpSetChart/components/SetsChartAxis/index.js +1 -0
  89. package/esm/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
  90. package/esm/UpSetChart/components/SetsChartAxis/styles.js +14 -0
  91. package/esm/UpSetChart/constants.d.ts +16 -3
  92. package/esm/UpSetChart/constants.js +19 -3
  93. package/esm/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
  94. package/esm/UpSetChart/gameOfThrones.test-data.js +23 -0
  95. package/esm/UpSetChart/helpers.d.ts +20 -0
  96. package/esm/UpSetChart/helpers.js +120 -0
  97. package/esm/UpSetChart/styles.d.ts +4 -1
  98. package/esm/UpSetChart/styles.js +11 -12
  99. package/esm/UpSetChart/types.d.ts +16 -0
  100. package/esm/UpSetChart/useUpSetChartSizes.d.ts +20 -0
  101. package/esm/UpSetChart/useUpSetChartSizes.js +30 -0
  102. package/esm/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +36 -0
  103. package/esm/features/crosswalks/AttributesTable/AttributesTable.test-data.js +283 -0
  104. package/esm/features/crosswalks/AttributesTable/AttributesTable.test.js +711 -350
  105. package/esm/features/crosswalks/ColoredBlock/ColoredBlock.test.js +77 -15
  106. package/esm/features/crosswalks/CopyableValueField/CopyableValueField.test.js +85 -15
  107. package/esm/features/crosswalks/CrosswalkAttributes/CrosswalkAttributes.test.js +266 -194
  108. package/esm/features/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.test.js +106 -12
  109. package/esm/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +21 -9
  110. package/esm/features/crosswalks/CrosswalkEditor/CrosswalkEditor.test.js +190 -90
  111. package/esm/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +324 -226
  112. package/esm/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +75 -12
  113. package/esm/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +171 -138
  114. package/package.json +1 -1
  115. package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.d.ts +0 -3
  116. package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.js +0 -52
  117. package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +0 -323
  118. package/cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +0 -142
  119. package/cjs/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.js +0 -146
  120. package/cjs/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.d.ts +0 -1
  121. package/cjs/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.js +0 -50
  122. package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.d.ts +0 -1
  123. package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +0 -58
  124. package/cjs/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.d.ts +0 -1
  125. package/cjs/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.js +0 -14
  126. package/cjs/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.d.ts +0 -1
  127. package/cjs/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.js +0 -110
  128. package/cjs/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.d.ts +0 -1
  129. package/cjs/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.js +0 -111
  130. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.d.ts +0 -1
  131. package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.js +0 -67
  132. package/cjs/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.d.ts +0 -1
  133. package/cjs/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.js +0 -193
  134. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.d.ts +0 -1
  135. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.js +0 -22
  136. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.d.ts +0 -1
  137. package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.js +0 -58
  138. package/cjs/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.d.ts +0 -1
  139. package/cjs/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.js +0 -69
  140. package/cjs/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.d.ts +0 -1
  141. package/cjs/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.js +0 -137
  142. package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +0 -1
  143. package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.js +0 -56
  144. package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.d.ts +0 -3
  145. package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.js +0 -47
  146. package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.d.ts +0 -1
  147. package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +0 -318
  148. package/esm/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.d.ts +0 -1
  149. package/esm/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +0 -137
  150. package/esm/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.d.ts +0 -1
  151. package/esm/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.js +0 -141
  152. package/esm/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.d.ts +0 -1
  153. package/esm/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.js +0 -45
  154. package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.d.ts +0 -1
  155. package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +0 -53
  156. package/esm/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.d.ts +0 -1
  157. package/esm/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.js +0 -9
  158. package/esm/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.d.ts +0 -1
  159. package/esm/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.js +0 -105
  160. package/esm/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.d.ts +0 -1
  161. package/esm/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.js +0 -106
  162. package/esm/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.d.ts +0 -1
  163. package/esm/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.js +0 -62
  164. package/esm/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.d.ts +0 -1
  165. package/esm/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.js +0 -188
  166. package/esm/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.d.ts +0 -1
  167. package/esm/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.js +0 -17
  168. package/esm/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.d.ts +0 -1
  169. package/esm/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.js +0 -53
  170. package/esm/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.d.ts +0 -1
  171. package/esm/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.js +0 -64
  172. package/esm/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.d.ts +0 -1
  173. package/esm/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.js +0 -132
  174. package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +0 -1
  175. package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.js +0 -28
  176. /package/cjs/{features/crosswalks/AttributesTable/IntegrationAttributesTable.test.d.ts → UpSetChart/UpSetChart.test.d.ts} +0 -0
  177. /package/{cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.d.ts → esm/UpSetChart/UpSetChart.test.d.ts} +0 -0
  178. /package/{cjs/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.d.ts → esm/UpSetChart/types.js} +0 -0
@@ -9,31 +9,125 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
12
48
  import React from 'react';
13
- import { shallow } from 'enzyme';
14
- import { TimestampEditor } from '../../../TimestampEditor';
49
+ import { render, screen } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
51
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
52
+ import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
15
53
  import { CrosswalkDateEditor } from './CrosswalkDateEditor';
16
54
  describe('CrosswalkDateEditor tests', function () {
17
55
  afterEach(function () {
18
56
  jest.clearAllMocks();
19
57
  });
20
58
  var date = new Date('01/01/2021').valueOf();
21
- var props = {
59
+ var defaultProps = {
22
60
  value: date,
23
61
  classes: { root: 'someClass' },
24
62
  onChange: jest.fn()
25
63
  };
64
+ var setUp = function (props) {
65
+ if (props === void 0) { props = defaultProps; }
66
+ var user = userEvent.setup();
67
+ var Providers = function (_a) {
68
+ var children = _a.children;
69
+ return React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment }, children);
70
+ };
71
+ return __assign(__assign({}, render(React.createElement(CrosswalkDateEditor, __assign({}, props)), { wrapper: Providers })), { user: user });
72
+ };
26
73
  it('should render CrosswalkDateEditor correctly', function () {
27
- var _a;
28
- var wrapper = shallow(React.createElement(CrosswalkDateEditor, __assign({}, props)));
29
- var dateEditor = wrapper.find(TimestampEditor);
30
- expect(dateEditor.prop('disabled')).toBeFalsy();
31
- expect(dateEditor.prop('value')).toEqual(date);
32
- expect(((_a = dateEditor.prop('slotProps')) === null || _a === void 0 ? void 0 : _a.textField).InputProps.classes.root).toContain('someClass');
74
+ setUp();
75
+ expect(screen.getByDisplayValue('01/01/2021 12:00:00 AM')).toBeInTheDocument();
76
+ expect(screen.getByDisplayValue('01/01/2021 12:00:00 AM').parentElement).toHaveClass('someClass');
33
77
  });
34
78
  it('should disable TimestampEditor if props.disabled = true', function () {
35
- var wrapper = shallow(React.createElement(CrosswalkDateEditor, __assign({}, props, { disabled: true })));
36
- var dateEditor = wrapper.find(TimestampEditor);
37
- expect(dateEditor.prop('disabled')).toBeTruthy();
79
+ setUp(__assign(__assign({}, defaultProps), { disabled: true }));
80
+ expect(screen.getByRole('button')).toBeDisabled();
81
+ expect(screen.getByRole('textbox')).toBeDisabled();
82
+ });
83
+ it('new should call props.onChange when calling TimestampEditor onClose prop', function () { return __awaiter(void 0, void 0, void 0, function () {
84
+ var user;
85
+ return __generator(this, function (_a) {
86
+ switch (_a.label) {
87
+ case 0:
88
+ user = setUp().user;
89
+ return [4 /*yield*/, user.click(screen.getByRole('button'))];
90
+ case 1:
91
+ _a.sent();
92
+ return [4 /*yield*/, user.click(screen.getByText('5'))];
93
+ case 2:
94
+ _a.sent();
95
+ expect(screen.getByDisplayValue('01/05/2021 12:00:00 AM')).toBeInTheDocument();
96
+ return [4 /*yield*/, user.click(screen.getAllByRole('button')[0])];
97
+ case 3:
98
+ _a.sent();
99
+ expect(defaultProps.onChange).toHaveBeenCalledWith(new Date('01/05/2021 12:00:00 AM').valueOf());
100
+ return [2 /*return*/];
101
+ }
102
+ });
103
+ }); });
104
+ it('should call props.onChange when calling TimestampEditor onBlur for input', function () { return __awaiter(void 0, void 0, void 0, function () {
105
+ var user, newDate;
106
+ return __generator(this, function (_a) {
107
+ switch (_a.label) {
108
+ case 0:
109
+ user = setUp().user;
110
+ newDate = '10/10/2021';
111
+ return [4 /*yield*/, user.type(screen.getByRole('textbox'), '01/01/2020')];
112
+ case 1:
113
+ _a.sent();
114
+ expect(screen.getByDisplayValue('01/01/2020 12:00:00 AM')).toBeInTheDocument();
115
+ return [4 /*yield*/, user.type(screen.getByRole('textbox'), newDate)];
116
+ case 2:
117
+ _a.sent();
118
+ expect(screen.getByDisplayValue('10/10/2021 12:00:00 AM')).toBeInTheDocument();
119
+ expect(defaultProps.onChange).not.toHaveBeenCalled();
120
+ return [4 /*yield*/, user.tab()];
121
+ case 3:
122
+ _a.sent();
123
+ expect(defaultProps.onChange).toHaveBeenCalledWith(new Date(newDate).valueOf());
124
+ return [2 /*return*/];
125
+ }
126
+ });
127
+ }); });
128
+ it('should change value of component when value property updated', function () {
129
+ var rerender = setUp().rerender;
130
+ rerender(React.createElement(CrosswalkDateEditor, __assign({}, defaultProps, { value: new Date('10/10/2021').valueOf() })));
131
+ expect(screen.getByDisplayValue('10/10/2021 12:00:00 AM')).toBeInTheDocument();
38
132
  });
39
133
  });
@@ -10,11 +10,21 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import React from 'react';
13
- import { shallow } from 'enzyme';
13
+ import { render, screen } from '@testing-library/react';
14
14
  import * as reactDnd from 'react-dnd';
15
- import { CrosswalkDragPreview } from './components/CrosswalkDragPreview';
16
15
  import { CrosswalkDragLayer } from './CrosswalkDragLayer';
16
+ import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
17
17
  jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDragLayer: jest.fn() })); });
18
+ var metadata = {
19
+ sources: [
20
+ {
21
+ uri: 'configuration/sources/FB',
22
+ label: 'Facebook',
23
+ icon: 'images/source/fb.png',
24
+ abbreviation: 'Facebook'
25
+ }
26
+ ]
27
+ };
18
28
  describe('CrosswalkDragLayer tests', function () {
19
29
  var monitor = {};
20
30
  jest.spyOn(reactDnd, 'useDragLayer').mockImplementation(function (fn) { return fn(monitor); });
@@ -24,8 +34,8 @@ describe('CrosswalkDragLayer tests', function () {
24
34
  getClientOffset: function () { return null; },
25
35
  getItem: function () { return null; }
26
36
  };
27
- var wrapper = shallow(React.createElement(CrosswalkDragLayer, null));
28
- expect(wrapper.find('.dragLayer')).toHaveLength(0);
37
+ var container = render(React.createElement(CrosswalkDragLayer, null)).container;
38
+ expect(container.querySelector('.dragLayer')).toBeNull();
29
39
  });
30
40
  it('should render drag item with correct offset', function () {
31
41
  monitor = {
@@ -33,9 +43,9 @@ describe('CrosswalkDragLayer tests', function () {
33
43
  getClientOffset: function () { return ({ x: 100, y: 200 }); },
34
44
  getItem: function () { return ({ type: 'Some Item' }); }
35
45
  };
36
- var wrapper = shallow(React.createElement(CrosswalkDragLayer, null));
37
- expect(wrapper.find('.dragLayer')).toHaveLength(1);
38
- expect(wrapper.find('.dragLayer > div').prop('style').transform).toBe('translate(100px, 200px');
46
+ var container = render(React.createElement(CrosswalkDragLayer, null)).container;
47
+ expect(container.querySelector('.dragLayer')).toBeInTheDocument();
48
+ expect(container.querySelector('.dragLayer > div')).toHaveStyle('transform: translate(100px, 200px');
39
49
  });
40
50
  it('should render CrosswalkDragPreview for crosswalk item', function () {
41
51
  var crosswalk = { uri: 'entities/1/crosswalks/1', type: 'configuration/sources/FB', value: '123' };
@@ -47,7 +57,9 @@ describe('CrosswalkDragLayer tests', function () {
47
57
  crosswalk: crosswalk
48
58
  }); }
49
59
  };
50
- var wrapper = shallow(React.createElement(CrosswalkDragLayer, null));
51
- expect(wrapper.find(CrosswalkDragPreview).prop('crosswalk')).toEqual(crosswalk);
60
+ render(React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
61
+ React.createElement(CrosswalkDragLayer, null)));
62
+ expect(screen.getByTestId('cw-colored-block')).toBeInTheDocument();
63
+ expect(screen.getByText('Facebook')).toBeInTheDocument();
52
64
  });
53
65
  });
@@ -9,103 +9,203 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
12
48
  import React from 'react';
13
- import { act } from 'react-dom/test-utils';
14
- import { shallow } from 'enzyme';
15
- import Button from '@mui/material/Button';
16
- import Typography from '@mui/material/Typography';
17
- import { CrosswalkAttributes } from '../CrosswalkAttributes';
49
+ import { render, screen, waitFor } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
51
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
52
+ import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
18
53
  import { CrosswalkEditor } from './CrosswalkEditor';
19
- describe('CrosswalkEditor tests', function () {
20
- var props = {
21
- onAdd: jest.fn(),
22
- onClose: jest.fn()
54
+ import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
55
+ var metadata = {
56
+ sources: [
57
+ {
58
+ uri: 'configuration/sources/Reltio',
59
+ label: 'Reltio',
60
+ icon: 'images/source/reltio.png',
61
+ abbreviation: 'Reltio'
62
+ },
63
+ {
64
+ uri: 'configuration/sources/AHA',
65
+ label: 'AHA',
66
+ icon: 'images/source/source_s.png',
67
+ abbreviation: 'AHA'
68
+ }
69
+ ]
70
+ };
71
+ var defaultProps = {
72
+ onAdd: jest.fn(),
73
+ onClose: jest.fn()
74
+ };
75
+ var setUp = function (props) {
76
+ if (props === void 0) { props = defaultProps; }
77
+ var user = userEvent.setup({ delay: null });
78
+ var Providers = function (_a) {
79
+ var children = _a.children;
80
+ return (React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
81
+ React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment }, children)));
23
82
  };
83
+ var renderer = render(React.createElement(CrosswalkEditor, __assign({}, props)), { wrapper: Providers });
84
+ return __assign(__assign({}, renderer), { user: user });
85
+ };
86
+ describe('CrosswalkEditor tests', function () {
24
87
  it('should render correctly', function () {
25
- var wrapper = shallow(React.createElement(CrosswalkEditor, __assign({}, props)));
26
- expect(wrapper.find(Typography).at(0).text()).toBe('Add crosswalk');
27
- expect(wrapper.find(CrosswalkAttributes).prop('crosswalk')).toEqual({ type: '', value: '' });
28
- expect(wrapper.find(Button).at(0).text()).toBe('Cancel');
29
- var addButton = wrapper.find(Button).at(1);
30
- expect(addButton.text()).toBe('Add');
31
- expect(addButton.prop('disabled')).toBe(true);
32
- });
33
- it('should modify crosswalk when calling CrosswalkAttributes prop onEditAttribute', function () {
34
- var wrapper = shallow(React.createElement(CrosswalkEditor, __assign({}, props)));
35
- var crosswalkAttributes = wrapper.find(CrosswalkAttributes);
36
- expect(crosswalkAttributes.prop('crosswalk')).toEqual({ type: '', value: '' });
37
- act(function () {
38
- crosswalkAttributes.prop('onEditAttribute')('type', 'configuration/sources/Reltio');
39
- });
40
- wrapper.update();
41
- expect(wrapper.find(CrosswalkAttributes).prop('crosswalk')).toEqual({
42
- type: 'configuration/sources/Reltio',
43
- value: ''
44
- });
45
- });
46
- it('should enable "Add" button when source system and id value are filled', function () {
47
- var wrapper = shallow(React.createElement(CrosswalkEditor, __assign({}, props)));
48
- expect(wrapper.find(Button).at(1).prop('disabled')).toBe(true);
49
- act(function () {
50
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('type', 'configuration/sources/Reltio');
51
- });
52
- wrapper.update();
53
- act(function () {
54
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('value', 'new id value');
55
- });
56
- wrapper.update();
57
- expect(wrapper.find(Button).at(1).prop('disabled')).toBe(false);
88
+ setUp();
89
+ expect(screen.getByText('Add crosswalk')).toBeInTheDocument();
90
+ expect(screen.getByText('Add attributes')).toBeInTheDocument();
91
+ expect(screen.getByText('Source System Name:')).toBeInTheDocument();
92
+ expect(screen.getByText('ID Value:')).toBeInTheDocument();
93
+ expect(screen.getByText('Cancel')).toBeInTheDocument();
94
+ expect(screen.getByText('Add')).toBeDisabled();
58
95
  });
59
- it('should call onAdd and onClose when calling "Add" button "onClick" prop', function () {
60
- var wrapper = shallow(React.createElement(CrosswalkEditor, __assign({}, props)));
61
- act(function () {
62
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('type', 'configuration/sources/Reltio');
96
+ it('should enable "Add" button when source system and id value are filled', function () { return __awaiter(void 0, void 0, void 0, function () {
97
+ var user;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ user = setUp().user;
102
+ return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
103
+ case 1:
104
+ _a.sent();
105
+ return [4 /*yield*/, user.click(screen.getByText('Reltio'))];
106
+ case 2:
107
+ _a.sent();
108
+ return [4 /*yield*/, user.type(screen.getByRole('textbox'), 'v')];
109
+ case 3:
110
+ _a.sent();
111
+ expect(screen.getByText('Add')).not.toBeDisabled();
112
+ return [2 /*return*/];
113
+ }
63
114
  });
64
- wrapper.update();
65
- act(function () {
66
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('value', 'new id value');
115
+ }); });
116
+ it('should call onAdd and onClose when calling "Add" button "onClick" prop', function () { return __awaiter(void 0, void 0, void 0, function () {
117
+ var user;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0:
121
+ user = setUp().user;
122
+ return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
123
+ case 1:
124
+ _a.sent();
125
+ return [4 /*yield*/, user.click(screen.getByText('Reltio'))];
126
+ case 2:
127
+ _a.sent();
128
+ return [4 /*yield*/, user.type(screen.getByRole('textbox'), 'v')];
129
+ case 3:
130
+ _a.sent();
131
+ return [4 /*yield*/, user.click(screen.getByText('Add'))];
132
+ case 4:
133
+ _a.sent();
134
+ expect(defaultProps.onAdd).toHaveBeenCalledWith({
135
+ type: 'configuration/sources/Reltio',
136
+ value: 'v'
137
+ });
138
+ expect(defaultProps.onClose).toHaveBeenCalled();
139
+ return [2 /*return*/];
140
+ }
67
141
  });
68
- wrapper.update();
69
- var onClick = wrapper.find(Button).at(1).prop('onClick');
70
- onClick();
71
- expect(props.onAdd).toHaveBeenCalledWith({
72
- type: 'configuration/sources/Reltio',
73
- value: 'new id value'
142
+ }); });
143
+ it('should call onClose when calling "Cancel" button "onClick" prop', function () { return __awaiter(void 0, void 0, void 0, function () {
144
+ var user;
145
+ return __generator(this, function (_a) {
146
+ switch (_a.label) {
147
+ case 0:
148
+ user = setUp().user;
149
+ return [4 /*yield*/, user.click(screen.getByText('Cancel'))];
150
+ case 1:
151
+ _a.sent();
152
+ expect(defaultProps.onClose).toHaveBeenCalled();
153
+ return [2 /*return*/];
154
+ }
74
155
  });
75
- expect(props.onClose).toHaveBeenCalled();
76
- });
77
- it('should call onClose when calling "Cancel" button "onClick" prop', function () {
78
- var wrapper = shallow(React.createElement(CrosswalkEditor, __assign({}, props)));
79
- var onClick = wrapper.find(Button).at(0).prop('onClick');
80
- onClick();
81
- expect(props.onClose).toHaveBeenCalled();
82
- });
83
- it('should call onAdd with correct params if deleteDate and sourceTable params are filled', function () {
84
- var wrapper = shallow(React.createElement(CrosswalkEditor, __assign({}, props)));
85
- act(function () {
86
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('type', 'configuration/sources/Reltio');
156
+ }); });
157
+ it('should call onAdd with correct params if deleteDate and sourceTable params are filled', function () { return __awaiter(void 0, void 0, void 0, function () {
158
+ var user;
159
+ return __generator(this, function (_a) {
160
+ switch (_a.label) {
161
+ case 0:
162
+ user = setUp().user;
163
+ return [4 /*yield*/, user.click(screen.getByText('Add attributes'))];
164
+ case 1:
165
+ _a.sent();
166
+ return [4 /*yield*/, user.click(screen.getByText('Delete Date'))];
167
+ case 2:
168
+ _a.sent();
169
+ return [4 /*yield*/, user.click(screen.getByText('Source Table'))];
170
+ case 3:
171
+ _a.sent();
172
+ return [4 /*yield*/, user.keyboard('{Escape}')];
173
+ case 4:
174
+ _a.sent();
175
+ return [4 /*yield*/, waitFor(function () {
176
+ expect(screen.getByText('Delete Date:')).toBeInTheDocument();
177
+ })];
178
+ case 5:
179
+ _a.sent();
180
+ return [4 /*yield*/, user.type(screen.getAllByRole('textbox')[1], 's')];
181
+ case 6:
182
+ _a.sent();
183
+ return [4 /*yield*/, user.type(screen.getAllByRole('textbox')[2], '01/01/2025 01:01:00 A')];
184
+ case 7:
185
+ _a.sent();
186
+ return [4 /*yield*/, user.tab()];
187
+ case 8:
188
+ _a.sent();
189
+ return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
190
+ case 9:
191
+ _a.sent();
192
+ return [4 /*yield*/, user.click(screen.getByText('AHA'))];
193
+ case 10:
194
+ _a.sent();
195
+ return [4 /*yield*/, user.type(screen.getAllByRole('textbox')[0], 'v')];
196
+ case 11:
197
+ _a.sent();
198
+ return [4 /*yield*/, user.click(screen.getByText('Add'))];
199
+ case 12:
200
+ _a.sent();
201
+ expect(defaultProps.onAdd).toHaveBeenCalledWith({
202
+ type: 'configuration/sources/AHA',
203
+ value: 'v',
204
+ deleteDate: new Date('01/01/2025 01:01:00').valueOf().toString(),
205
+ sourceTable: 's'
206
+ });
207
+ return [2 /*return*/];
208
+ }
87
209
  });
88
- wrapper.update();
89
- act(function () {
90
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('value', 'new id value');
91
- });
92
- wrapper.update();
93
- var deleteDate = new Date('2021-01-01').valueOf().toString();
94
- act(function () {
95
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('deleteDate', deleteDate);
96
- });
97
- wrapper.update();
98
- act(function () {
99
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')('sourceTable', 'new sourceTable');
100
- });
101
- wrapper.update();
102
- var onClick = wrapper.find(Button).at(1).prop('onClick');
103
- onClick();
104
- expect(props.onAdd).toHaveBeenCalledWith({
105
- type: 'configuration/sources/Reltio',
106
- value: 'new id value',
107
- deleteDate: deleteDate,
108
- sourceTable: 'new sourceTable'
109
- });
110
- });
210
+ }); });
111
211
  });