@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,25 +9,50 @@ 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 { mount } from 'enzyme';
14
- import { map, prop } from 'ramda';
15
- import moment from 'moment';
16
- import { act } from 'react-dom/test-utils';
17
- import DeleteIcon from '@mui/icons-material/Delete';
18
- import { CrosswalksAttrTypes, DataTypes, SortingStrategy, formatDateTime } from '@reltio/mdm-sdk';
49
+ import { render, within, 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';
53
+ import { formatDateTime } from '@reltio/mdm-sdk';
19
54
  import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
20
- import { ConfirmDeleteDialog } from '../../../ConfirmDeleteDialog';
21
- import { MoreAttributesButton } from '../../../MoreAttributesButton';
22
- import { SimpleDropDownSelector } from '../../../SimpleDropDownSelector';
23
- import { SmallIconButtonWithTooltip } from '../../../SmallIconButton';
24
- import { TextEditor } from '../../../TextEditor';
25
- import { CopyableValueField } from '../CopyableValueField';
26
- import { CrosswalkDateEditor } from '../CrosswalkDateEditor';
27
55
  import { CrosswalkAttributes } from './CrosswalkAttributes';
28
- jest.mock('../CrosswalkDateEditor', function () { return ({
29
- CrosswalkDateEditor: function () { return null; }
30
- }); });
31
56
  var metadata = {
32
57
  sources: [
33
58
  {
@@ -44,7 +69,6 @@ var metadata = {
44
69
  }
45
70
  ]
46
71
  };
47
- var attributesSortingStrategy = SortingStrategy.ASC_BY_NAME;
48
72
  var crosswalk = {
49
73
  uri: 'entities/j8K1vc9/crosswalks/1kQ5cap2n',
50
74
  type: 'configuration/sources/Reltio',
@@ -66,202 +90,250 @@ var defaultProps = {
66
90
  };
67
91
  var setUp = function (props) {
68
92
  if (props === void 0) { props = defaultProps; }
69
- return mount(React.createElement(MdmModuleProvider, { values: { metadata: metadata, attributesSortingStrategy: attributesSortingStrategy } },
70
- React.createElement(CrosswalkAttributes, __assign({}, props))));
93
+ var user = userEvent.setup({ delay: null });
94
+ var Providers = function (_a) {
95
+ var children = _a.children;
96
+ return (React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
97
+ React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment }, children)));
98
+ };
99
+ var renderer = render(React.createElement(CrosswalkAttributes, __assign({}, props)), { wrapper: Providers });
100
+ return __assign(__assign({}, renderer), { user: user });
71
101
  };
72
102
  describe('CrosswalkAttributes tests', function () {
73
103
  afterEach(function () {
74
104
  jest.clearAllMocks();
75
105
  });
76
106
  it('should render edit mode correctly', function () {
77
- var wrapper = setUp();
78
- var moreButton = wrapper.find(MoreAttributesButton);
79
- expect(wrapper.find(MoreAttributesButton).prop('label')).toBe('Add attributes');
80
- var extraAttributes = map(prop('label'), moreButton.prop('data'));
81
- expect(extraAttributes).toEqual(['Delete Date']);
82
- expect(wrapper.find('p.attributeTitle').at(0).text()).toBe('Source System Name:');
83
- expect(wrapper.find('.attributeValue').at(0).text()).toBe(metadata.sources[0].label);
84
- expect(wrapper.find('p.attributeTitle').at(1).text()).toBe('ID Value:');
85
- expect(wrapper.find(CopyableValueField).prop('value')).toBe(crosswalk.value);
86
- expect(wrapper.find('p.attributeTitle').at(2).text()).toBe('Create Date:');
87
- expect(wrapper.find('.attributeValue').at(2).text()).toBe(formatDateTime(crosswalk.createDate));
88
- expect(wrapper.find('p.attributeTitle').at(3).text()).toBe('Update Date:');
89
- expect(wrapper.find('.attributeValue').at(3).text()).toBe(formatDateTime(crosswalk.updateDate));
90
- expect(wrapper.find('p.attributeTitle').at(4).text()).toBe('Reltio Load Date:');
91
- expect(wrapper.find('.attributeValue').at(4).text()).toBe(formatDateTime(crosswalk.reltioLoadDate));
107
+ setUp();
108
+ expect(screen.getByText('Add attributes')).toBeInTheDocument();
109
+ expect(screen.getByText('Source System Name:')).toBeInTheDocument();
110
+ expect(screen.getByText('Reltio')).toBeInTheDocument();
111
+ expect(screen.getByText('ID Value:')).toBeInTheDocument();
112
+ expect(screen.getByText(crosswalk.value)).toBeInTheDocument();
113
+ expect(screen.getByText('Create Date:')).toBeInTheDocument();
114
+ expect(screen.getByText(formatDateTime(crosswalk.createDate))).toBeInTheDocument();
115
+ expect(screen.getByText('Update Date:')).toBeInTheDocument();
116
+ expect(screen.getByText(formatDateTime(crosswalk.updateDate))).toBeInTheDocument();
117
+ expect(screen.getByText('Reltio Load Date:')).toBeInTheDocument();
118
+ expect(screen.getByText(formatDateTime(crosswalk.reltioLoadDate))).toBeInTheDocument();
92
119
  });
93
120
  it('should render create mode correctly', function () {
94
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk }));
95
- var moreButton = wrapper.find(MoreAttributesButton);
96
- expect(wrapper.find(MoreAttributesButton).prop('label')).toBe('Add attributes');
97
- var extraAttributes = map(prop('label'), moreButton.prop('data'));
98
- expect(extraAttributes).toEqual(['Source Table', 'Delete Date']);
99
- expect(wrapper.find('p.attributeTitle').at(0).text()).toBe('Source System Name:');
100
- expect(wrapper.find(SimpleDropDownSelector).props()).toMatchObject({
101
- value: {
102
- value: ''
103
- },
104
- options: [
105
- {
106
- value: 'configuration/sources/AHA',
107
- label: 'AHA'
108
- },
109
- {
110
- value: 'configuration/sources/Reltio',
111
- label: 'Reltio'
112
- }
113
- ]
114
- });
115
- expect(wrapper.find('p.attributeTitle').at(1).text()).toBe('ID Value:');
116
- expect(wrapper.find(TextEditor).prop('value')).toBe('');
121
+ setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk }));
122
+ expect(screen.getByText('Add attributes')).toBeInTheDocument();
123
+ expect(screen.getByText('Source System Name:')).toBeInTheDocument();
124
+ expect(screen.getByTestId('crosswalk-attribute-type-selector')).toBeInTheDocument();
125
+ expect(screen.getByText('ID Value:')).toBeInTheDocument();
126
+ expect(screen.getByRole('textbox')).toBeInTheDocument();
117
127
  });
118
- it('should render deleteDate editor when it is added from MoreAttributesButton selector', function () {
119
- var wrapper = setUp();
120
- act(function () {
121
- wrapper.find(MoreAttributesButton).prop('onApply')([
122
- {
123
- label: CrosswalksAttrTypes.deleteDate.label,
124
- uri: 'deleteDate',
125
- name: 'crosswalks.deleteDate',
126
- type: DataTypes.TYPE_TIMESTAMP
127
- }
128
- ]);
128
+ it('should render deleteDate editor when it is added from MoreAttributesButton selector', function () { return __awaiter(void 0, void 0, void 0, function () {
129
+ var user;
130
+ return __generator(this, function (_a) {
131
+ switch (_a.label) {
132
+ case 0:
133
+ user = setUp().user;
134
+ return [4 /*yield*/, user.click(screen.getByText('Add attributes'))];
135
+ case 1:
136
+ _a.sent();
137
+ return [4 /*yield*/, user.click(screen.getByText('Delete Date'))];
138
+ case 2:
139
+ _a.sent();
140
+ return [4 /*yield*/, user.keyboard('{Escape}')];
141
+ case 3:
142
+ _a.sent();
143
+ return [4 /*yield*/, waitFor(function () {
144
+ expect(screen.getByText('Delete Date:')).toBeInTheDocument();
145
+ })];
146
+ case 4:
147
+ _a.sent();
148
+ return [4 /*yield*/, user.hover(screen.getByLabelText('Delete attribute'))];
149
+ case 5:
150
+ _a.sent();
151
+ expect(within(screen.getByRole('tooltip')).getByText('Delete attribute')).toBeInTheDocument();
152
+ return [2 /*return*/];
153
+ }
129
154
  });
130
- wrapper.update();
131
- expect(wrapper.find('p.attributeTitle').at(4).text()).toBe('Delete Date:');
132
- expect(wrapper.find(CrosswalkDateEditor).prop('value')).toBeUndefined();
133
- expect(wrapper.find(SmallIconButtonWithTooltip).props()).toMatchObject({
134
- icon: DeleteIcon,
135
- disabled: false,
136
- tooltipTitle: 'Delete attribute'
155
+ }); });
156
+ it('should provide correct value to deleteDate editor and call props.onEditAttribute on editing', function () { return __awaiter(void 0, void 0, void 0, function () {
157
+ var deleteDate, newDeleteDate, user;
158
+ return __generator(this, function (_a) {
159
+ switch (_a.label) {
160
+ case 0:
161
+ deleteDate = '2021-02-02';
162
+ newDeleteDate = new Date('2021-01-01').valueOf();
163
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }) })).user;
164
+ expect(screen.getByDisplayValue(/^02\/02\/2021/)).toBeInTheDocument();
165
+ return [4 /*yield*/, user.type(screen.getByRole('textbox'), '01/01/2021')];
166
+ case 1:
167
+ _a.sent();
168
+ return [4 /*yield*/, user.click(screen.getByText('Delete Date:'))];
169
+ case 2:
170
+ _a.sent();
171
+ expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('deleteDate', newDeleteDate.toString());
172
+ return [2 /*return*/];
173
+ }
137
174
  });
138
- });
139
- it('should provide correct value to deleteDate editor and call props.onEditAttribute on editing', function () {
140
- var deleteDate = '2021-02-02';
141
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }) }));
142
- expect(wrapper.find(CrosswalkDateEditor).prop('value')).toBe(moment.utc(deleteDate).valueOf());
143
- var newDeleteDate = new Date('2021-01-01').valueOf();
144
- act(function () {
145
- wrapper.find(CrosswalkDateEditor).prop('onChange')(newDeleteDate);
175
+ }); });
176
+ it('should render sourceTable editor when it is added from MoreAttributesButton selector', function () { return __awaiter(void 0, void 0, void 0, function () {
177
+ var user;
178
+ return __generator(this, function (_a) {
179
+ switch (_a.label) {
180
+ case 0:
181
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk })).user;
182
+ return [4 /*yield*/, user.click(screen.getByText('Add attributes'))];
183
+ case 1:
184
+ _a.sent();
185
+ return [4 /*yield*/, user.click(screen.getByText('Source Table'))];
186
+ case 2:
187
+ _a.sent();
188
+ return [4 /*yield*/, user.keyboard('{Escape}')];
189
+ case 3:
190
+ _a.sent();
191
+ return [4 /*yield*/, waitFor(function () {
192
+ expect(screen.getByText('Source Table:')).toBeInTheDocument();
193
+ })];
194
+ case 4:
195
+ _a.sent();
196
+ return [4 /*yield*/, user.hover(screen.getByLabelText('Delete attribute'))];
197
+ case 5:
198
+ _a.sent();
199
+ expect(within(screen.getByRole('tooltip')).getByText('Delete attribute')).toBeInTheDocument();
200
+ return [2 /*return*/];
201
+ }
146
202
  });
147
- expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('deleteDate', newDeleteDate.toString());
148
- });
149
- it('should work correctly with deleteDate timestamps', function () {
150
- var deleteDate = '123456789';
151
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }) }));
152
- expect(wrapper.find(CrosswalkDateEditor).prop('value')).toBe(123456789);
153
- });
154
- it('should render sourceTable editor when it is added from MoreAttributesButton selector', function () {
155
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk }));
156
- act(function () {
157
- wrapper.find(MoreAttributesButton).prop('onApply')([
158
- {
159
- label: CrosswalksAttrTypes.sourceTable.label,
160
- uri: 'sourceTable',
161
- name: 'crosswalks.sourceTable',
162
- type: DataTypes.TYPE_STRING
163
- }
164
- ]);
203
+ }); });
204
+ it('should provide correct value to sourceTable editor and call props.onEditAttribute on editing', function () { return __awaiter(void 0, void 0, void 0, function () {
205
+ var user;
206
+ return __generator(this, function (_a) {
207
+ switch (_a.label) {
208
+ case 0:
209
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk })).user;
210
+ return [4 /*yield*/, user.click(screen.getByText('Add attributes'))];
211
+ case 1:
212
+ _a.sent();
213
+ return [4 /*yield*/, user.click(screen.getByText('Source Table'))];
214
+ case 2:
215
+ _a.sent();
216
+ return [4 /*yield*/, user.keyboard('{Escape}')];
217
+ case 3:
218
+ _a.sent();
219
+ return [4 /*yield*/, waitFor(function () {
220
+ expect(screen.getByText('Source Table:')).toBeInTheDocument();
221
+ })];
222
+ case 4:
223
+ _a.sent();
224
+ return [4 /*yield*/, user.type(screen.getAllByRole('textbox')[1], 'new sourceTable')];
225
+ case 5:
226
+ _a.sent();
227
+ expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('sourceTable', 'new sourceTable');
228
+ return [2 /*return*/];
229
+ }
165
230
  });
166
- wrapper.update();
167
- expect(wrapper.find('p.attributeTitle').at(2).text()).toBe('Source Table:');
168
- expect(wrapper.find(TextEditor).length).toBe(2);
169
- expect(wrapper.find(TextEditor).at(1).prop('value')).toBeUndefined();
170
- expect(wrapper.find(SmallIconButtonWithTooltip).props()).toMatchObject({
171
- icon: DeleteIcon,
172
- disabled: false,
173
- tooltipTitle: 'Delete attribute'
231
+ }); });
232
+ it('should provide correct value to sourceSystem editor and call props.onEditAttribute on editing', function () { return __awaiter(void 0, void 0, void 0, function () {
233
+ var user;
234
+ return __generator(this, function (_a) {
235
+ switch (_a.label) {
236
+ case 0:
237
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk })).user;
238
+ return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
239
+ case 1:
240
+ _a.sent();
241
+ return [4 /*yield*/, user.click(screen.getByText('Reltio'))];
242
+ case 2:
243
+ _a.sent();
244
+ expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('type', 'configuration/sources/Reltio');
245
+ return [2 /*return*/];
246
+ }
174
247
  });
175
- });
176
- it('should provide correct value to sourceTable editor and call props.onEditAttribute on editing', function () {
177
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk }));
178
- act(function () {
179
- wrapper.find(MoreAttributesButton).prop('onApply')([
180
- {
181
- label: CrosswalksAttrTypes.sourceTable.label,
182
- uri: 'sourceTable',
183
- name: 'crosswalks.sourceTable',
184
- type: DataTypes.TYPE_STRING
185
- }
186
- ]);
248
+ }); });
249
+ it('should provide correct value to value editor and call props.onEditAttribute on editing', function () { return __awaiter(void 0, void 0, void 0, function () {
250
+ var user;
251
+ return __generator(this, function (_a) {
252
+ switch (_a.label) {
253
+ case 0:
254
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk })).user;
255
+ return [4 /*yield*/, user.type(screen.getByRole('textbox'), 'new id value')];
256
+ case 1:
257
+ _a.sent();
258
+ expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('value', 'new id value');
259
+ return [2 /*return*/];
260
+ }
187
261
  });
188
- wrapper.update();
189
- act(function () {
190
- wrapper.find(TextEditor).at(1).prop('onInput')({
191
- target: { value: 'new sourceTable' }
192
- });
262
+ }); });
263
+ it('should call props.onDeleteAttribute when confirm deleting attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
264
+ var deleteDate, user;
265
+ return __generator(this, function (_a) {
266
+ switch (_a.label) {
267
+ case 0:
268
+ deleteDate = '2021-02-02';
269
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }) })).user;
270
+ return [4 /*yield*/, user.click(within(screen.getByLabelText('Delete attribute')).getByRole('button'))];
271
+ case 1:
272
+ _a.sent();
273
+ expect(screen.getByText('Are you sure you want to delete this?')).toBeInTheDocument();
274
+ expect(screen.getByText('Yes')).toBeInTheDocument();
275
+ expect(screen.getByText('No')).toBeInTheDocument();
276
+ return [4 /*yield*/, user.click(screen.getByText('Yes'))];
277
+ case 2:
278
+ _a.sent();
279
+ expect(defaultProps.onDeleteAttribute).toHaveBeenCalledWith('deleteDate');
280
+ return [2 /*return*/];
281
+ }
193
282
  });
194
- expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('sourceTable', 'new sourceTable');
195
- });
196
- it('should provide correct value to sourceSystem editor and call props.onEditAttribute on editing', function () {
197
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk }));
198
- act(function () {
199
- wrapper.find(SimpleDropDownSelector).prop('onChange')({
200
- value: 'configuration/sources/Reltio',
201
- label: 'Reltio'
202
- });
283
+ }); });
284
+ it('should not call props.onDeleteAttribute without confirmation of deleting attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
285
+ var deleteDate, user;
286
+ return __generator(this, function (_a) {
287
+ switch (_a.label) {
288
+ case 0:
289
+ deleteDate = '2021-02-02';
290
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }) })).user;
291
+ return [4 /*yield*/, user.click(within(screen.getByLabelText('Delete attribute')).getByRole('button'))];
292
+ case 1:
293
+ _a.sent();
294
+ return [4 /*yield*/, user.click(screen.getByText('No'))];
295
+ case 2:
296
+ _a.sent();
297
+ expect(defaultProps.onDeleteAttribute).not.toHaveBeenCalled();
298
+ return [2 /*return*/];
299
+ }
203
300
  });
204
- expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('type', 'configuration/sources/Reltio');
205
- });
206
- it('should provide correct value to value editor and call props.onEditAttribute on editing', function () {
207
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: newCrosswalk }));
208
- act(function () {
209
- wrapper.find(TextEditor).prop('onInput')({
210
- target: { value: 'new id value' }
211
- });
301
+ }); });
302
+ it('should not call props.onDeleteAttribute when confirm deleting attribute if attribute is not set', function () { return __awaiter(void 0, void 0, void 0, function () {
303
+ var user;
304
+ return __generator(this, function (_a) {
305
+ switch (_a.label) {
306
+ case 0:
307
+ user = setUp().user;
308
+ return [4 /*yield*/, user.click(screen.getByText('Add attributes'))];
309
+ case 1:
310
+ _a.sent();
311
+ return [4 /*yield*/, user.click(screen.getByText('Delete Date'))];
312
+ case 2:
313
+ _a.sent();
314
+ return [4 /*yield*/, user.keyboard('{Escape}')];
315
+ case 3:
316
+ _a.sent();
317
+ return [4 /*yield*/, waitFor(function () {
318
+ expect(screen.getByText('Delete Date:')).toBeInTheDocument();
319
+ })];
320
+ case 4:
321
+ _a.sent();
322
+ return [4 /*yield*/, user.click(within(screen.getByLabelText('Delete attribute')).getByRole('button'))];
323
+ case 5:
324
+ _a.sent();
325
+ return [4 /*yield*/, user.click(screen.getByText('Yes'))];
326
+ case 6:
327
+ _a.sent();
328
+ expect(defaultProps.onDeleteAttribute).not.toHaveBeenCalled();
329
+ return [2 /*return*/];
330
+ }
212
331
  });
213
- expect(defaultProps.onEditAttribute).toHaveBeenCalledWith('value', 'new id value');
214
- });
215
- it('should call props.onDeleteAttribute when confirm deleting attribute', function () {
216
- var deleteDate = '2021-02-02';
217
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }) }));
218
- act(function () {
219
- wrapper.find(SmallIconButtonWithTooltip).prop('onClick')({});
220
- });
221
- wrapper.update();
222
- act(function () {
223
- wrapper.find(ConfirmDeleteDialog).prop('onConfirm')();
224
- });
225
- expect(defaultProps.onDeleteAttribute).toHaveBeenCalledWith('deleteDate');
226
- });
227
- it('should not call props.onDeleteAttribute without confirmation of deleting attribute', function () {
228
- var deleteDate = '2021-02-02';
229
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }) }));
230
- act(function () {
231
- wrapper.find(SmallIconButtonWithTooltip).prop('onClick')({});
232
- });
233
- wrapper.update();
234
- act(function () {
235
- wrapper.find(ConfirmDeleteDialog).prop('onClose')();
236
- });
237
- expect(defaultProps.onDeleteAttribute).not.toHaveBeenCalled();
238
- });
239
- it('should not call props.onDeleteAttribute when confirm deleting attribute if attribute is not set', function () {
240
- var wrapper = setUp();
241
- act(function () {
242
- wrapper.find(MoreAttributesButton).prop('onApply')([
243
- {
244
- label: CrosswalksAttrTypes.deleteDate.label,
245
- uri: 'deleteDate',
246
- name: 'crosswalks.deleteDate',
247
- type: DataTypes.TYPE_TIMESTAMP
248
- }
249
- ]);
250
- });
251
- wrapper.update();
252
- act(function () {
253
- wrapper.find(SmallIconButtonWithTooltip).prop('onClick')({});
254
- });
255
- wrapper.update();
256
- act(function () {
257
- wrapper.find(ConfirmDeleteDialog).prop('onConfirm')();
258
- });
259
- expect(defaultProps.onDeleteAttribute).not.toHaveBeenCalled();
260
- });
332
+ }); });
261
333
  it('should render correctly if props.canEditAttribute = false', function () {
262
334
  var deleteDate = '2021-02-02';
263
- var wrapper = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }), canEditAttribute: false }));
264
- expect(wrapper.find(MoreAttributesButton).length).toBe(0);
265
- expect(wrapper.find(SmallIconButtonWithTooltip).prop('disabled')).toBeTruthy();
335
+ setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: deleteDate }), canEditAttribute: false }));
336
+ expect(screen.queryByText('Add attributes')).not.toBeInTheDocument();
337
+ expect(within(screen.getByLabelText('Delete attribute')).getByRole('button')).toBeDisabled();
266
338
  });
267
339
  });