@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,27 +9,56 @@ 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 { act } from '@testing-library/react-hooks';
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 { ThemeProvider } from '@mui/styles';
54
+ import { createTheme } from '@mui/material/styles';
15
55
  import * as reactDnd from 'react-dnd';
16
56
  import { getEmptyImage } from 'react-dnd-html5-backend';
17
- import { SortingStrategy, isCrosswalkDisabled } from '@reltio/mdm-sdk';
18
- import VisibilityIcon from '@mui/icons-material/Visibility';
19
- import Typography from '@mui/material/Typography';
20
- import DeleteIcon from '@mui/icons-material/Delete';
57
+ import { isCrosswalkDisabled, theme } from '@reltio/mdm-sdk';
21
58
  import * as CrosswalksDisplay from '../../../contexts/CrosswalksDisplayContext';
22
59
  import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
23
- import { ArrowExpandButton } from '../../../ArrowExpandButton';
24
- import { ConfirmDeleteDialog } from '../../../ConfirmDeleteDialog';
25
- import { SmallIconButtonWithTooltip } from '../../../SmallIconButton';
26
- import { SourceIcon } from '../../../SourceIcon';
27
- import DependentIcon from '../../../icons/NestedAttribute';
28
- import { ExpandedValueTooltip } from '../../../ExpandedValueTooltip';
29
- import { rerenderWrapper } from '../../../test-utils';
30
- import { ColoredBlock } from '../ColoredBlock';
31
- import { CrosswalkAttributes } from '../CrosswalkAttributes';
32
60
  import { CrosswalkRow } from './CrosswalkRow';
61
+ jest.unmock('@mui/styles');
33
62
  jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDrag: jest.fn() })); });
34
63
  jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { isCrosswalkDisabled: jest.fn() })); });
35
64
  var metadata = {
@@ -48,7 +77,6 @@ var metadata = {
48
77
  }
49
78
  ]
50
79
  };
51
- var attributesSortingStrategy = SortingStrategy.ASC_BY_NAME;
52
80
  var crosswalk = {
53
81
  uri: 'entities/j8K1vc9/crosswalks/1kQ5cap2n',
54
82
  type: 'configuration/sources/Reltio',
@@ -69,11 +97,15 @@ var defaultProps = {
69
97
  };
70
98
  var setUp = function (props) {
71
99
  if (props === void 0) { props = defaultProps; }
72
- var Component = function (props) {
73
- return (React.createElement(MdmModuleProvider, { values: { metadata: metadata, attributesSortingStrategy: attributesSortingStrategy } },
74
- React.createElement(CrosswalkRow, __assign({}, props))));
100
+ var user = userEvent.setup({ delay: null });
101
+ var Providers = function (_a) {
102
+ var children = _a.children;
103
+ return (React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
104
+ React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
105
+ React.createElement(ThemeProvider, { theme: createTheme(theme) }, children))));
75
106
  };
76
- return mount(React.createElement(Component, __assign({}, props)));
107
+ var renderer = render(React.createElement(CrosswalkRow, __assign({}, props)), { wrapper: Providers });
108
+ return __assign(__assign({}, renderer), { user: user });
77
109
  };
78
110
  describe('CrosswalkRow tests', function () {
79
111
  var highlightCrosswalk = jest.fn();
@@ -99,57 +131,79 @@ describe('CrosswalkRow tests', function () {
99
131
  });
100
132
  jest.spyOn(CrosswalksDisplay, 'useCrosswalkColor').mockImplementation(function (crosswalk) { return crosswalk === null || crosswalk === void 0 ? void 0 : crosswalk.value; });
101
133
  });
102
- it('should render crosswalk correctly', function () {
103
- var wrapper = setUp();
104
- var button = wrapper.find(SmallIconButtonWithTooltip);
105
- expect(button).toBeDefined();
106
- expect(button.props()).toMatchObject({
107
- icon: VisibilityIcon,
108
- tooltipTitle: 'Focus',
109
- disabled: false
134
+ it('should render crosswalk correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
135
+ var user, focusButton;
136
+ return __generator(this, function (_a) {
137
+ switch (_a.label) {
138
+ case 0:
139
+ user = setUp().user;
140
+ focusButton = screen.getByLabelText('Focus');
141
+ expect(focusButton).toBeInTheDocument();
142
+ expect(focusButton.querySelector('svg')).toBeInTheDocument();
143
+ expect(screen.getByTestId('arrow-expand-button')).toBeInTheDocument();
144
+ expect(screen.getByTestId('cw-colored-block')).toBeInTheDocument();
145
+ expect(screen.getByText(metadata.sources[0].label)).toBeInTheDocument();
146
+ expect(screen.getByText(crosswalk.value)).toBeInTheDocument();
147
+ expect(screen.getByRole('img')).toHaveAttribute('src', expect.stringMatching(metadata.sources[0].icon));
148
+ return [4 /*yield*/, user.hover(focusButton)];
149
+ case 1:
150
+ _a.sent();
151
+ expect(within(screen.getByRole('tooltip')).getByText('Focus')).toBeInTheDocument();
152
+ return [2 /*return*/];
153
+ }
110
154
  });
111
- expect(wrapper.find(ColoredBlock).prop('color')).toBe('some value');
112
- expect(wrapper.find(ColoredBlock).prop('variant')).toBe('standart');
113
- expect(wrapper.find(ArrowExpandButton)).toBeDefined();
114
- expect(wrapper.find(SourceIcon)).toBeDefined();
115
- expect(wrapper.find(Typography).length).toBe(2);
116
- expect(wrapper.find(Typography).at(0).text()).toBe(metadata.sources[0].label);
117
- expect(wrapper.find(Typography).at(1).text()).toBe(crosswalk.value);
118
- expect(wrapper.find(ExpandedValueTooltip).at(0).prop('value')).toBe(metadata.sources[0].label);
119
- expect(wrapper.find(ExpandedValueTooltip).at(1).prop('value')).toBe(crosswalk.value);
120
- });
121
- it('should support highlighting', function () {
122
- var wrapper = setUp();
123
- var coloredBlock = wrapper.find(ColoredBlock);
124
- coloredBlock.simulate('mouseenter');
125
- expect(highlightCrosswalk).toHaveBeenCalledTimes(1);
126
- coloredBlock.simulate('mouseleave');
127
- expect(removeHighlight).toHaveBeenCalledTimes(1);
128
- });
155
+ }); });
156
+ it('should support highlighting', function () { return __awaiter(void 0, void 0, void 0, function () {
157
+ var user;
158
+ return __generator(this, function (_a) {
159
+ switch (_a.label) {
160
+ case 0:
161
+ user = setUp().user;
162
+ return [4 /*yield*/, user.hover(screen.getByTestId('cw-colored-block'))];
163
+ case 1:
164
+ _a.sent();
165
+ expect(highlightCrosswalk).toHaveBeenCalledTimes(1);
166
+ return [4 /*yield*/, user.unhover(screen.getByTestId('cw-colored-block'))];
167
+ case 2:
168
+ _a.sent();
169
+ expect(removeHighlight).toHaveBeenCalledTimes(1);
170
+ return [2 /*return*/];
171
+ }
172
+ });
173
+ }); });
129
174
  it('should render disabled button without icon if focusable === false', function () {
130
- var wrapper = setUp(__assign(__assign({}, defaultProps), { focusable: false }));
131
- var button = wrapper.find(SmallIconButtonWithTooltip);
132
- expect(button.prop('disabled')).toBe(true);
133
- expect(button.prop('icon')).toBeFalsy();
175
+ setUp(__assign(__assign({}, defaultProps), { focusable: false }));
176
+ var focusButton = screen.getAllByRole('button')[0];
177
+ expect(focusButton).toBeDisabled();
178
+ expect(focusButton.querySelector('svg')).not.toBeInTheDocument();
134
179
  });
135
180
  it('should render white background if props.isEmpty=true', function () {
136
- var wrapper = setUp(__assign(__assign({}, defaultProps), { isEmpty: true }));
137
- expect(wrapper.find(ColoredBlock).prop('color')).toBe('#FFF');
181
+ setUp(__assign(__assign({}, defaultProps), { isEmpty: true }));
182
+ expect(getComputedStyle(screen.getByTestId('cw-colored-block')).backgroundColor).toBe('rgb(255, 255, 255)');
138
183
  });
139
184
  it('should render grey background if props.isColored=false', function () {
140
- var wrapper = setUp(__assign(__assign({}, defaultProps), { isColored: false }));
141
- expect(wrapper.find(ColoredBlock).prop('color')).toBe('#CACCD1');
185
+ setUp(__assign(__assign({}, defaultProps), { isColored: false }));
186
+ expect(getComputedStyle(screen.getByTestId('cw-colored-block')).backgroundColor).toBe('rgb(202, 204, 209)');
142
187
  });
143
188
  it('should pass disabled variant prop for disabled crosswalk', function () {
144
189
  isCrosswalkDisabled.mockReturnValue(true);
145
- var wrapper = setUp();
146
- expect(wrapper.find(ColoredBlock).prop('variant')).toBe('disabled');
147
- });
148
- it('should call onToggleFocus when click on eye icon', function () {
149
- var wrapper = setUp();
150
- wrapper.find(SmallIconButtonWithTooltip).find('button').simulate('click');
151
- expect(toggleCrosswalkFocus).toHaveBeenCalledTimes(1);
190
+ setUp();
191
+ expect(screen.getByLabelText('End-dated crosswalk')).toBeInTheDocument();
152
192
  });
193
+ it('should call onToggleFocus when click on eye icon', function () { return __awaiter(void 0, void 0, void 0, function () {
194
+ var user;
195
+ return __generator(this, function (_a) {
196
+ switch (_a.label) {
197
+ case 0:
198
+ user = setUp().user;
199
+ return [4 /*yield*/, user.click(screen.getByLabelText('Focus'))];
200
+ case 1:
201
+ _a.sent();
202
+ expect(toggleCrosswalkFocus).toHaveBeenCalledTimes(1);
203
+ return [2 /*return*/];
204
+ }
205
+ });
206
+ }); });
153
207
  it('should render dependent icon if isDependent prop is true', function () {
154
208
  var dependentProps = {
155
209
  crosswalk: crosswalk,
@@ -159,182 +213,226 @@ describe('CrosswalkRow tests', function () {
159
213
  onDelete: jest.fn(),
160
214
  onEdit: jest.fn()
161
215
  };
162
- var wrapper = setUp(dependentProps);
163
- expect(wrapper.find(DependentIcon)).toBeDefined();
164
- });
165
- it('should toggle crosswalk attributes when click on expand icon', function () {
166
- var wrapper = setUp();
167
- act(function () {
168
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
169
- });
170
- rerenderWrapper(wrapper);
171
- var deleteButton = wrapper
172
- .find(SmallIconButtonWithTooltip)
173
- .findWhere(function (n) { return n.prop('icon') === DeleteIcon; })
174
- .at(0);
175
- expect(deleteButton.props()).toMatchObject({
176
- disabled: false,
177
- tooltipTitle: 'Delete crosswalk'
178
- });
179
- expect(wrapper.find(CrosswalkAttributes).props()).toMatchObject({
180
- crosswalk: defaultProps.crosswalk,
181
- canEditAttribute: true
182
- });
183
- act(function () {
184
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
185
- });
186
- rerenderWrapper(wrapper);
187
- var newDeleteButton = wrapper
188
- .find(SmallIconButtonWithTooltip)
189
- .findWhere(function (n) { return n.prop('className') === 'deleteCrosswalkButton'; });
190
- expect(newDeleteButton.length).toBe(0);
191
- expect(wrapper.find(CrosswalkAttributes).length).toBe(0);
192
- });
193
- it('should disable delete icon if props.disableDelete = true', function () {
194
- var wrapper = setUp(__assign(__assign({}, defaultProps), { disableDelete: true }));
195
- act(function () {
196
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
197
- });
198
- rerenderWrapper(wrapper);
199
- var deleteButton = wrapper
200
- .find(SmallIconButtonWithTooltip)
201
- .findWhere(function (n) { return n.prop('icon') === DeleteIcon; })
202
- .at(0);
203
- expect(deleteButton.prop('disabled')).toBeTruthy();
204
- expect(deleteButton.prop('tooltipTitle')).toBe("You don't have permissions to delete");
205
- });
206
- it('should disable editing in CrosswalkAttributes if props.disableEdit = true', function () {
207
- var wrapper = setUp(__assign(__assign({}, defaultProps), { disableEdit: true }));
208
- act(function () {
209
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
210
- });
211
- rerenderWrapper(wrapper);
212
- expect(wrapper.find(CrosswalkAttributes).prop('canEditAttribute')).toBeFalsy();
213
- });
214
- it('should not render delete button for reference crosswalk', function () {
215
- var props = __assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { ownerType: 'relation' }) });
216
- var wrapper = setUp(props);
217
- act(function () {
218
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
219
- });
220
- rerenderWrapper(wrapper);
221
- var deleteButton = wrapper
222
- .find(SmallIconButtonWithTooltip)
223
- .findWhere(function (n) { return n.prop('className') === 'deleteCrosswalkButton'; });
224
- expect(deleteButton).toHaveLength(0);
216
+ setUp(dependentProps);
217
+ expect(screen.getByTestId('SvgNestedAttribute')).toBeInTheDocument();
225
218
  });
226
- it('should not render delete button for disabled crosswalk', function () {
227
- isCrosswalkDisabled.mockReturnValue(true);
228
- var wrapper = setUp();
229
- act(function () {
230
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
231
- });
232
- rerenderWrapper(wrapper);
233
- var deleteButton = wrapper
234
- .find(SmallIconButtonWithTooltip)
235
- .findWhere(function (n) { return n.prop('className') === 'deleteCrosswalkButton'; });
236
- expect(deleteButton).toHaveLength(0);
237
- });
238
- it('should call props.onDelete and not call toggleCrosswalkFocus if isFocused === false after confirmation on crosswalk delete', function () {
239
- var wrapper = setUp();
240
- act(function () {
241
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
242
- });
243
- rerenderWrapper(wrapper);
244
- expect(wrapper.find(ConfirmDeleteDialog).at(0).at(0).prop('open')).toBe(false);
245
- act(function () {
246
- wrapper
247
- .find(SmallIconButtonWithTooltip)
248
- .findWhere(function (n) { return n.prop('icon') === DeleteIcon; })
249
- .find('button')
250
- .simulate('click');
251
- });
252
- rerenderWrapper(wrapper);
253
- expect(wrapper.find(ConfirmDeleteDialog).at(0).prop('open')).toBe(true);
254
- act(function () {
255
- wrapper.find(ConfirmDeleteDialog).at(0).prop('onConfirm')();
219
+ it('should toggle crosswalk attributes when click on expand icon', function () { return __awaiter(void 0, void 0, void 0, function () {
220
+ var user;
221
+ return __generator(this, function (_a) {
222
+ switch (_a.label) {
223
+ case 0:
224
+ user = setUp().user;
225
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
226
+ case 1:
227
+ _a.sent();
228
+ return [4 /*yield*/, user.hover(screen.getByLabelText('Delete crosswalk'))];
229
+ case 2:
230
+ _a.sent();
231
+ expect(within(screen.getByRole('tooltip')).getByText('Delete crosswalk')).toBeInTheDocument();
232
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
233
+ case 3:
234
+ _a.sent();
235
+ expect(screen.queryByLabelText('Delete crosswalk')).not.toBeInTheDocument();
236
+ return [2 /*return*/];
237
+ }
256
238
  });
257
- wrapper.update();
258
- expect(defaultProps.onDelete).toHaveBeenCalledWith('1kQ5cap2n');
259
- expect(toggleCrosswalkFocus).toHaveBeenCalledTimes(0);
260
- });
261
- it('should call props.onDelete and call toggleCrosswalkFocus if isFocused === true after confirmation on crosswalk delete', function () {
262
- jest.spyOn(CrosswalksDisplay, 'useCrosswalkFocus').mockReturnValue({
263
- isFocused: true,
264
- toggleCrosswalkFocus: toggleCrosswalkFocus
239
+ }); });
240
+ it('should disable delete icon if props.disableDelete = true', function () { return __awaiter(void 0, void 0, void 0, function () {
241
+ var user;
242
+ return __generator(this, function (_a) {
243
+ switch (_a.label) {
244
+ case 0:
245
+ user = setUp(__assign(__assign({}, defaultProps), { disableDelete: true })).user;
246
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
247
+ case 1:
248
+ _a.sent();
249
+ expect(within(screen.getByLabelText("You don't have permissions to delete")).getByRole('button')).toBeDisabled();
250
+ return [4 /*yield*/, user.hover(screen.getByLabelText("You don't have permissions to delete"))];
251
+ case 2:
252
+ _a.sent();
253
+ expect(within(screen.getByRole('tooltip')).getByText("You don't have permissions to delete")).toBeInTheDocument();
254
+ return [2 /*return*/];
255
+ }
265
256
  });
266
- var wrapper = setUp();
267
- act(function () {
268
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
257
+ }); });
258
+ it('should disable editing in CrosswalkAttributes if props.disableEdit = true', function () { return __awaiter(void 0, void 0, void 0, function () {
259
+ var user;
260
+ return __generator(this, function (_a) {
261
+ switch (_a.label) {
262
+ case 0:
263
+ user = setUp(__assign(__assign({}, defaultProps), { disableEdit: true })).user;
264
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
265
+ case 1:
266
+ _a.sent();
267
+ expect(screen.queryByText('Add attributes')).not.toBeInTheDocument();
268
+ return [2 /*return*/];
269
+ }
269
270
  });
270
- rerenderWrapper(wrapper);
271
- expect(wrapper.find(ConfirmDeleteDialog).at(0).prop('open')).toBe(false);
272
- act(function () {
273
- wrapper
274
- .find(SmallIconButtonWithTooltip)
275
- .findWhere(function (n) { return n.prop('icon') === DeleteIcon; })
276
- .find('button')
277
- .simulate('click');
271
+ }); });
272
+ it('should not render delete button for reference crosswalk', function () { return __awaiter(void 0, void 0, void 0, function () {
273
+ var props, user;
274
+ return __generator(this, function (_a) {
275
+ switch (_a.label) {
276
+ case 0:
277
+ props = __assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { ownerType: 'relation' }) });
278
+ user = setUp(props).user;
279
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
280
+ case 1:
281
+ _a.sent();
282
+ expect(screen.queryByLabelText('Delete crosswalk')).not.toBeInTheDocument();
283
+ return [2 /*return*/];
284
+ }
278
285
  });
279
- rerenderWrapper(wrapper);
280
- expect(wrapper.find(ConfirmDeleteDialog).at(0).prop('open')).toBe(true);
281
- act(function () {
282
- wrapper.find(ConfirmDeleteDialog).at(0).prop('onConfirm')();
286
+ }); });
287
+ it('should not render delete button for disabled crosswalk', function () { return __awaiter(void 0, void 0, void 0, function () {
288
+ var user;
289
+ return __generator(this, function (_a) {
290
+ switch (_a.label) {
291
+ case 0:
292
+ isCrosswalkDisabled.mockReturnValue(true);
293
+ user = setUp().user;
294
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
295
+ case 1:
296
+ _a.sent();
297
+ expect(screen.queryByLabelText('Delete crosswalk')).not.toBeInTheDocument();
298
+ return [2 /*return*/];
299
+ }
283
300
  });
284
- rerenderWrapper(wrapper);
285
- expect(defaultProps.onDelete).toHaveBeenCalledWith('1kQ5cap2n');
286
- expect(toggleCrosswalkFocus).toHaveBeenCalledTimes(1);
287
- });
288
- it('should not call props.onDelete without confirmation on crosswalk delete', function () {
289
- var wrapper = setUp();
290
- act(function () {
291
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
301
+ }); });
302
+ it('should call props.onDelete and not call toggleCrosswalkFocus if isFocused === false after confirmation on crosswalk delete', 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.getByTestId('arrow-expand-button'))];
309
+ case 1:
310
+ _a.sent();
311
+ return [4 /*yield*/, user.click(within(screen.getByLabelText('Delete crosswalk')).getByRole('button'))];
312
+ case 2:
313
+ _a.sent();
314
+ expect(screen.getByText('Are you sure you want to delete this?')).toBeInTheDocument();
315
+ return [4 /*yield*/, user.click(screen.getByText('Yes'))];
316
+ case 3:
317
+ _a.sent();
318
+ expect(defaultProps.onDelete).toHaveBeenCalledWith('1kQ5cap2n');
319
+ expect(toggleCrosswalkFocus).toHaveBeenCalledTimes(0);
320
+ return [2 /*return*/];
321
+ }
292
322
  });
293
- rerenderWrapper(wrapper);
294
- expect(wrapper.find(ConfirmDeleteDialog).at(0).prop('open')).toBe(false);
295
- act(function () {
296
- wrapper
297
- .find(SmallIconButtonWithTooltip)
298
- .findWhere(function (n) { return n.prop('icon') === DeleteIcon; })
299
- .find('button')
300
- .simulate('click');
323
+ }); });
324
+ it('should call props.onDelete and call toggleCrosswalkFocus if isFocused === true after confirmation on crosswalk delete', function () { return __awaiter(void 0, void 0, void 0, function () {
325
+ var user;
326
+ return __generator(this, function (_a) {
327
+ switch (_a.label) {
328
+ case 0:
329
+ jest.spyOn(CrosswalksDisplay, 'useCrosswalkFocus').mockReturnValue({
330
+ isFocused: true,
331
+ toggleCrosswalkFocus: toggleCrosswalkFocus
332
+ });
333
+ user = setUp().user;
334
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
335
+ case 1:
336
+ _a.sent();
337
+ return [4 /*yield*/, user.click(within(screen.getByLabelText('Delete crosswalk')).getByRole('button'))];
338
+ case 2:
339
+ _a.sent();
340
+ return [4 /*yield*/, user.click(screen.getByText('Yes'))];
341
+ case 3:
342
+ _a.sent();
343
+ expect(defaultProps.onDelete).toHaveBeenCalledWith('1kQ5cap2n');
344
+ expect(toggleCrosswalkFocus).toHaveBeenCalledTimes(1);
345
+ return [2 /*return*/];
346
+ }
301
347
  });
302
- rerenderWrapper(wrapper);
303
- expect(wrapper.find(ConfirmDeleteDialog).at(0).prop('open')).toBe(true);
304
- act(function () {
305
- wrapper.find(ConfirmDeleteDialog).at(0).prop('onClose')();
348
+ }); });
349
+ it('should not call props.onDelete without confirmation on crosswalk delete', function () { return __awaiter(void 0, void 0, void 0, function () {
350
+ var user;
351
+ return __generator(this, function (_a) {
352
+ switch (_a.label) {
353
+ case 0:
354
+ user = setUp().user;
355
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
356
+ case 1:
357
+ _a.sent();
358
+ return [4 /*yield*/, user.click(within(screen.getByLabelText('Delete crosswalk')).getByRole('button'))];
359
+ case 2:
360
+ _a.sent();
361
+ return [4 /*yield*/, user.click(screen.getByText('No'))];
362
+ case 3:
363
+ _a.sent();
364
+ expect(defaultProps.onDelete).not.toHaveBeenCalled();
365
+ return [2 /*return*/];
366
+ }
306
367
  });
307
- rerenderWrapper(wrapper);
308
- expect(wrapper.find(ConfirmDeleteDialog).at(0).prop('open')).toBe(false);
309
- expect(defaultProps.onDelete).not.toHaveBeenCalled();
310
- });
311
- it('should call props.onEdit when calling CrosswalkAttributes onEditAttribute prop', function () {
312
- var wrapper = setUp();
313
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
314
- rerenderWrapper(wrapper);
315
- var attributeName = 'deleteDate';
316
- var value = new Date('01/01/2001').valueOf().toString();
317
- wrapper.find(CrosswalkAttributes).prop('onEditAttribute')(attributeName, value);
318
- expect(defaultProps.onEdit).toHaveBeenCalledWith({
319
- crosswalkId: '1kQ5cap2n',
320
- attributeName: attributeName,
321
- value: value
368
+ }); });
369
+ it('should call props.onEdit when calling CrosswalkAttributes onEditAttribute prop', function () { return __awaiter(void 0, void 0, void 0, function () {
370
+ var dateString, newDeleteDate, user;
371
+ return __generator(this, function (_a) {
372
+ switch (_a.label) {
373
+ case 0:
374
+ dateString = '01/01/2025 01:01:00';
375
+ newDeleteDate = new Date(dateString).valueOf();
376
+ user = setUp().user;
377
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
378
+ case 1:
379
+ _a.sent();
380
+ return [4 /*yield*/, user.click(screen.getByText('Add attributes'))];
381
+ case 2:
382
+ _a.sent();
383
+ return [4 /*yield*/, user.click(screen.getByText('Delete Date'))];
384
+ case 3:
385
+ _a.sent();
386
+ return [4 /*yield*/, user.keyboard('{Escape}')];
387
+ case 4:
388
+ _a.sent();
389
+ return [4 /*yield*/, waitFor(function () {
390
+ expect(screen.getByText('Delete Date:')).toBeInTheDocument();
391
+ })];
392
+ case 5:
393
+ _a.sent();
394
+ return [4 /*yield*/, user.type(screen.getByRole('textbox'), dateString + 'A')];
395
+ case 6:
396
+ _a.sent();
397
+ return [4 /*yield*/, user.click(screen.getByText('Delete Date:'))];
398
+ case 7:
399
+ _a.sent();
400
+ expect(defaultProps.onEdit).toHaveBeenCalledWith({
401
+ crosswalkId: '1kQ5cap2n',
402
+ attributeName: 'deleteDate',
403
+ value: newDeleteDate.toString()
404
+ });
405
+ return [2 /*return*/];
406
+ }
322
407
  });
323
- });
324
- it('should call props.onEdit when calling CrosswalkAttributes onDeleteAttribute prop', function () {
325
- var wrapper = setUp();
326
- wrapper.find(ArrowExpandButton).find('button').simulate('click');
327
- rerenderWrapper(wrapper);
328
- var attributeName = 'deleteDate';
329
- wrapper.find(CrosswalkAttributes).prop('onDeleteAttribute')(attributeName);
330
- expect(defaultProps.onEdit).toHaveBeenCalledWith({
331
- crosswalkId: '1kQ5cap2n',
332
- attributeName: attributeName
408
+ }); });
409
+ it('should call props.onEdit when calling CrosswalkAttributes onDeleteAttribute prop', function () { return __awaiter(void 0, void 0, void 0, function () {
410
+ var user;
411
+ return __generator(this, function (_a) {
412
+ switch (_a.label) {
413
+ case 0:
414
+ user = setUp(__assign(__assign({}, defaultProps), { crosswalk: __assign(__assign({}, crosswalk), { deleteDate: '2021-02-02' }) })).user;
415
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
416
+ case 1:
417
+ _a.sent();
418
+ return [4 /*yield*/, user.click(within(screen.getByLabelText('Delete attribute')).getByRole('button'))];
419
+ case 2:
420
+ _a.sent();
421
+ return [4 /*yield*/, user.click(screen.getByText('Yes'))];
422
+ case 3:
423
+ _a.sent();
424
+ expect(defaultProps.onEdit).toHaveBeenCalledWith({
425
+ crosswalkId: '1kQ5cap2n',
426
+ attributeName: 'deleteDate'
427
+ });
428
+ return [2 /*return*/];
429
+ }
333
430
  });
334
- });
431
+ }); });
335
432
  it('should scroll to row if focusable and current crosswalk is highlighted', function () {
336
- var wrapper = setUp(__assign(__assign({}, defaultProps), { focusable: true }));
337
- var node = wrapper.find('.root').getDOMNode();
433
+ var props = __assign(__assign({}, defaultProps), { focusable: true });
434
+ var _a = setUp(props), container = _a.container, rerender = _a.rerender;
435
+ var node = container.querySelector('body > div > div');
338
436
  node.scrollIntoView = jest.fn();
339
437
  expect(node.scrollIntoView).not.toHaveBeenCalled();
340
438
  useHighlightedCrosswalksMock.mockReturnValueOnce([
@@ -344,7 +442,7 @@ describe('CrosswalkRow tests', function () {
344
442
  value: 'some value'
345
443
  }
346
444
  ]);
347
- wrapper.setProps({ crosswalk: __assign({}, crosswalk) });
445
+ rerender(React.createElement(CrosswalkRow, __assign({}, props, { crosswalk: __assign({}, crosswalk) })));
348
446
  expect(node.scrollIntoView).toHaveBeenCalled();
349
447
  });
350
448
  describe('dnd', function () {