@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.
- package/cjs/UpSetChart/UpSetChart.d.ts +5 -8
- package/cjs/UpSetChart/UpSetChart.js +61 -5
- package/cjs/UpSetChart/UpSetChart.test.js +198 -0
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +66 -0
- package/cjs/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChart/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChart/styles.js +32 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +64 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.js +32 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +56 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.js +27 -0
- package/cjs/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
- package/cjs/UpSetChart/components/SetsChart/SetsChart.js +58 -0
- package/cjs/UpSetChart/components/SetsChart/index.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChart/index.js +5 -0
- package/cjs/UpSetChart/components/SetsChart/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChart/styles.js +43 -0
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +20 -0
- package/cjs/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChartAxis/index.js +5 -0
- package/cjs/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChartAxis/styles.js +17 -0
- package/cjs/UpSetChart/constants.d.ts +16 -3
- package/cjs/UpSetChart/constants.js +20 -4
- package/cjs/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
- package/cjs/UpSetChart/gameOfThrones.test-data.js +26 -0
- package/cjs/UpSetChart/helpers.d.ts +20 -0
- package/cjs/UpSetChart/helpers.js +127 -0
- package/cjs/UpSetChart/styles.d.ts +4 -1
- package/cjs/UpSetChart/styles.js +11 -12
- package/cjs/UpSetChart/types.d.ts +16 -0
- package/cjs/UpSetChart/types.js +2 -0
- package/cjs/UpSetChart/useUpSetChartSizes.d.ts +20 -0
- package/cjs/UpSetChart/useUpSetChartSizes.js +34 -0
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +36 -0
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +288 -0
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +708 -370
- package/cjs/features/crosswalks/ColoredBlock/ColoredBlock.test.js +77 -15
- package/cjs/features/crosswalks/CopyableValueField/CopyableValueField.test.js +85 -15
- package/cjs/features/crosswalks/CrosswalkAttributes/CrosswalkAttributes.test.js +265 -193
- package/cjs/features/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.test.js +106 -12
- package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +21 -9
- package/cjs/features/crosswalks/CrosswalkEditor/CrosswalkEditor.test.js +190 -90
- package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +323 -225
- package/cjs/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +75 -12
- package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +171 -138
- package/esm/UpSetChart/UpSetChart.d.ts +5 -8
- package/esm/UpSetChart/UpSetChart.js +38 -5
- package/esm/UpSetChart/UpSetChart.test.js +193 -0
- package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
- package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +39 -0
- package/esm/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/styles.js +29 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +34 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/styles.js +29 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +26 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/styles.js +24 -0
- package/esm/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
- package/esm/UpSetChart/components/SetsChart/SetsChart.js +31 -0
- package/esm/UpSetChart/components/SetsChart/index.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChart/index.js +1 -0
- package/esm/UpSetChart/components/SetsChart/styles.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChart/styles.js +40 -0
- package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
- package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +13 -0
- package/esm/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/index.js +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/styles.js +14 -0
- package/esm/UpSetChart/constants.d.ts +16 -3
- package/esm/UpSetChart/constants.js +19 -3
- package/esm/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
- package/esm/UpSetChart/gameOfThrones.test-data.js +23 -0
- package/esm/UpSetChart/helpers.d.ts +20 -0
- package/esm/UpSetChart/helpers.js +120 -0
- package/esm/UpSetChart/styles.d.ts +4 -1
- package/esm/UpSetChart/styles.js +11 -12
- package/esm/UpSetChart/types.d.ts +16 -0
- package/esm/UpSetChart/useUpSetChartSizes.d.ts +20 -0
- package/esm/UpSetChart/useUpSetChartSizes.js +30 -0
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +36 -0
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test-data.js +283 -0
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test.js +711 -350
- package/esm/features/crosswalks/ColoredBlock/ColoredBlock.test.js +77 -15
- package/esm/features/crosswalks/CopyableValueField/CopyableValueField.test.js +85 -15
- package/esm/features/crosswalks/CrosswalkAttributes/CrosswalkAttributes.test.js +266 -194
- package/esm/features/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.test.js +106 -12
- package/esm/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +21 -9
- package/esm/features/crosswalks/CrosswalkEditor/CrosswalkEditor.test.js +190 -90
- package/esm/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +324 -226
- package/esm/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +75 -12
- package/esm/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +171 -138
- package/package.json +1 -1
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.d.ts +0 -3
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.js +0 -52
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +0 -323
- package/cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +0 -142
- package/cjs/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.js +0 -146
- package/cjs/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.js +0 -50
- package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +0 -58
- package/cjs/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.js +0 -14
- package/cjs/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.js +0 -110
- package/cjs/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.js +0 -111
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.js +0 -67
- package/cjs/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.js +0 -193
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.js +0 -22
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.js +0 -58
- package/cjs/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.js +0 -69
- package/cjs/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.d.ts +0 -1
- package/cjs/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.js +0 -137
- package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +0 -1
- package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.js +0 -56
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.d.ts +0 -3
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.js +0 -47
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +0 -318
- package/esm/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +0 -137
- package/esm/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.js +0 -141
- package/esm/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.js +0 -45
- package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +0 -53
- package/esm/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.js +0 -9
- package/esm/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.js +0 -105
- package/esm/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.js +0 -106
- package/esm/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.js +0 -62
- package/esm/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.js +0 -188
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.js +0 -17
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.js +0 -53
- package/esm/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.js +0 -64
- package/esm/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.d.ts +0 -1
- package/esm/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.js +0 -132
- package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +0 -1
- package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.js +0 -28
- /package/cjs/{features/crosswalks/AttributesTable/IntegrationAttributesTable.test.d.ts → UpSetChart/UpSetChart.test.d.ts} +0 -0
- /package/{cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.d.ts → esm/UpSetChart/UpSetChart.test.d.ts} +0 -0
- /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 {
|
|
14
|
-
import
|
|
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 {
|
|
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
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
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
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
131
|
-
var
|
|
132
|
-
expect(
|
|
133
|
-
expect(
|
|
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
|
-
|
|
137
|
-
expect(
|
|
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
|
-
|
|
141
|
-
expect(
|
|
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
|
-
|
|
146
|
-
expect(
|
|
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
|
-
|
|
163
|
-
expect(
|
|
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
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
|
337
|
-
var
|
|
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
|
-
|
|
445
|
+
rerender(React.createElement(CrosswalkRow, __assign({}, props, { crosswalk: __assign({}, crosswalk) })));
|
|
348
446
|
expect(node.scrollIntoView).toHaveBeenCalled();
|
|
349
447
|
});
|
|
350
448
|
describe('dnd', function () {
|