@reltio/components 1.4.1999 → 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/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/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.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +0 -323
- package/cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +0 -142
- package/cjs/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.d.ts +0 -1
- 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
|
@@ -1,20 +1,83 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
4
51
|
import { ShowDependentLink } from './ShowDependentLink';
|
|
52
|
+
var onClick = jest.fn();
|
|
53
|
+
var props = {
|
|
54
|
+
showMore: true,
|
|
55
|
+
onClick: onClick
|
|
56
|
+
};
|
|
5
57
|
describe('ShowDependentLink tests', function () {
|
|
6
58
|
it('should render "View dependent crosswalks" link for props.showMore=true', function () {
|
|
7
|
-
|
|
8
|
-
expect(
|
|
59
|
+
render(React.createElement(ShowDependentLink, __assign({}, props)));
|
|
60
|
+
expect(screen.getByText('View dependent crosswalks')).toBeInTheDocument();
|
|
61
|
+
expect(screen.queryByText('Hide dependent crosswalks')).not.toBeInTheDocument();
|
|
9
62
|
});
|
|
10
63
|
it('should render "Hide dependent crosswalks" link for props.showMore=false', function () {
|
|
11
|
-
|
|
12
|
-
expect(
|
|
13
|
-
|
|
14
|
-
it('should render call props.onClick on link click', function () {
|
|
15
|
-
var onClick = jest.fn();
|
|
16
|
-
var wrapper = shallow(React.createElement(ShowDependentLink, { showMore: true, onClick: onClick }));
|
|
17
|
-
wrapper.find(Link).simulate('click');
|
|
18
|
-
expect(onClick).toHaveBeenCalled();
|
|
64
|
+
render(React.createElement(ShowDependentLink, __assign({}, props, { showMore: false })));
|
|
65
|
+
expect(screen.getByText('Hide dependent crosswalks')).toBeInTheDocument();
|
|
66
|
+
expect(screen.queryByText('View dependent crosswalks')).not.toBeInTheDocument();
|
|
19
67
|
});
|
|
68
|
+
it('should render call props.onClick on link click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
var user;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
user = userEvent.setup();
|
|
74
|
+
render(React.createElement(ShowDependentLink, __assign({}, props)));
|
|
75
|
+
return [4 /*yield*/, user.click(screen.getByRole('button'))];
|
|
76
|
+
case 1:
|
|
77
|
+
_a.sent();
|
|
78
|
+
expect(onClick).toHaveBeenCalled();
|
|
79
|
+
return [2 /*return*/];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); });
|
|
20
83
|
});
|
|
@@ -9,16 +9,71 @@ 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 } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
|
+
import { ThemeProvider } from '@mui/styles';
|
|
52
|
+
import { createTheme } from '@mui/material/styles';
|
|
15
53
|
import * as CrosswalksDisplay from '../../../contexts/CrosswalksDisplayContext';
|
|
16
|
-
import { DummyCrosswalkRow } from '../DummyCrosswalkRow';
|
|
17
|
-
import { ShowDependentLink } from '../ShowDependentLink';
|
|
18
|
-
import { CrosswalkRow } from '../CrosswalkRow';
|
|
19
54
|
import { SourceCrosswalksRow } from './SourceCrosswalksRow';
|
|
55
|
+
import { theme } from '@reltio/mdm-sdk';
|
|
56
|
+
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
57
|
+
jest.unmock('@mui/styles');
|
|
58
|
+
jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDrag: jest.fn().mockReturnValue([undefined, function () { return null; }, jest.fn()]) })); });
|
|
59
|
+
var metadata = {
|
|
60
|
+
sources: [
|
|
61
|
+
{
|
|
62
|
+
uri: 'configuration/sources/FB',
|
|
63
|
+
label: 'Facebook',
|
|
64
|
+
icon: 'images/source/fb.png',
|
|
65
|
+
abbreviation: 'Facebook'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
uri: 'configuration/sources/Reltio',
|
|
69
|
+
label: 'Reltio',
|
|
70
|
+
icon: 'images/source/reltio.png',
|
|
71
|
+
abbreviation: 'Reltio'
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
};
|
|
20
75
|
describe('SourceCrosswalksRow tests', function () {
|
|
21
|
-
var
|
|
76
|
+
var defaultProps = {
|
|
22
77
|
source: 'configuration/sources/FB',
|
|
23
78
|
onEdit: jest.fn(),
|
|
24
79
|
onDelete: jest.fn(),
|
|
@@ -26,71 +81,49 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
26
81
|
showCrosswalkColors: true,
|
|
27
82
|
disableEditCrosswalk: false,
|
|
28
83
|
disableDeleteCrosswalk: false,
|
|
29
|
-
onToggleExpanded: jest.fn()
|
|
30
|
-
|
|
31
|
-
var useHighlightedCrosswalksMock = jest.spyOn(CrosswalksDisplay, 'useHighlightedCrosswalks').mockReturnValue([]);
|
|
32
|
-
beforeAll(function () {
|
|
33
|
-
jest.spyOn(CrosswalkRow, 'type').mockImplementation(EmptyStub);
|
|
34
|
-
});
|
|
35
|
-
it('should render dummy crosswalk if no simple and empty crosswalks, and show more link', function () {
|
|
36
|
-
var crosswalksByTypes = {
|
|
84
|
+
onToggleExpanded: jest.fn(),
|
|
85
|
+
crosswalksByTypes: {
|
|
37
86
|
empty: [],
|
|
38
87
|
simple: [],
|
|
39
88
|
dependent: [
|
|
40
89
|
{
|
|
41
90
|
uri: 'entities/2/crosswalks/1',
|
|
42
91
|
value: '456',
|
|
43
|
-
type: 'configuration/sources/
|
|
92
|
+
type: 'configuration/sources/Reltio'
|
|
44
93
|
}
|
|
45
94
|
]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var setUp = function (props) {
|
|
98
|
+
if (props === void 0) { props = defaultProps; }
|
|
99
|
+
var user = userEvent.setup({ delay: null });
|
|
100
|
+
var Providers = function (_a) {
|
|
101
|
+
var children = _a.children;
|
|
102
|
+
return (React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
|
|
103
|
+
React.createElement(ThemeProvider, { theme: createTheme(theme) }, children)));
|
|
46
104
|
};
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
105
|
+
var renderer = render(React.createElement(SourceCrosswalksRow, __assign({}, props)), { wrapper: Providers });
|
|
106
|
+
return __assign(__assign({}, renderer), { user: user });
|
|
107
|
+
};
|
|
108
|
+
var useHighlightedCrosswalksMock = jest.spyOn(CrosswalksDisplay, 'useHighlightedCrosswalks').mockReturnValue([]);
|
|
109
|
+
it('should render dummy crosswalk if no simple and empty crosswalks, and show more link', function () {
|
|
110
|
+
setUp();
|
|
111
|
+
expect(screen.getByText('Facebook')).toBeInTheDocument();
|
|
112
|
+
expect(screen.getByText('View dependent crosswalks')).toBeInTheDocument();
|
|
53
113
|
});
|
|
54
114
|
it('should render dummy crosswalk and dependent if no simple and empty crosswalks, and show less link', function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
uri: 'entities/2/crosswalks/1',
|
|
61
|
-
value: '456',
|
|
62
|
-
type: 'configuration/sources/FB'
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
};
|
|
66
|
-
var wrapper = shallow(React.createElement(SourceCrosswalksRow, __assign({}, props, { crosswalksByTypes: crosswalksByTypes, expanded: true })));
|
|
67
|
-
expect(wrapper.find(DummyCrosswalkRow).props()).toEqual({
|
|
68
|
-
crosswalkType: props.source,
|
|
69
|
-
focusable: props.crosswalksFocusEnabled
|
|
70
|
-
});
|
|
71
|
-
expect(wrapper.find(CrosswalkRow).props()).toEqual({
|
|
72
|
-
crosswalk: {
|
|
73
|
-
uri: 'entities/2/crosswalks/1',
|
|
74
|
-
value: '456',
|
|
75
|
-
type: 'configuration/sources/FB'
|
|
76
|
-
},
|
|
77
|
-
isDependent: true,
|
|
78
|
-
disableEdit: props.disableEditCrosswalk,
|
|
79
|
-
disableDelete: props.disableDeleteCrosswalk,
|
|
80
|
-
onDelete: props.onDelete,
|
|
81
|
-
onEdit: props.onEdit,
|
|
82
|
-
isColored: props.showCrosswalkColors,
|
|
83
|
-
focusable: props.crosswalksFocusEnabled
|
|
84
|
-
});
|
|
85
|
-
expect(wrapper.find(ShowDependentLink).prop('showMore')).toBe(false);
|
|
115
|
+
setUp(__assign(__assign({}, defaultProps), { expanded: true }));
|
|
116
|
+
expect(screen.getByText('Facebook')).toBeInTheDocument();
|
|
117
|
+
expect(screen.getByText('Reltio')).toBeInTheDocument();
|
|
118
|
+
expect(screen.getByText('Hide dependent crosswalks')).toBeInTheDocument();
|
|
86
119
|
});
|
|
87
|
-
it('should render
|
|
120
|
+
it('should render simple crosswalk and then empty crosswalks if present', function () {
|
|
88
121
|
var crosswalksByTypes = {
|
|
89
122
|
empty: [
|
|
90
123
|
{
|
|
91
124
|
uri: 'entities/2/crosswalks/1',
|
|
92
125
|
value: '123',
|
|
93
|
-
type: 'configuration/sources/
|
|
126
|
+
type: 'configuration/sources/Reltio'
|
|
94
127
|
}
|
|
95
128
|
],
|
|
96
129
|
simple: [
|
|
@@ -102,85 +135,85 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
102
135
|
],
|
|
103
136
|
dependent: []
|
|
104
137
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
expect(
|
|
109
|
-
expect(
|
|
110
|
-
|
|
111
|
-
uri: 'entities/2/crosswalks/2',
|
|
112
|
-
value: '456',
|
|
113
|
-
type: 'configuration/sources/FB'
|
|
114
|
-
},
|
|
115
|
-
disableEdit: props.disableEditCrosswalk,
|
|
116
|
-
disableDelete: props.disableDeleteCrosswalk,
|
|
117
|
-
onDelete: props.onDelete,
|
|
118
|
-
onEdit: props.onEdit,
|
|
119
|
-
isColored: props.showCrosswalkColors,
|
|
120
|
-
focusable: props.crosswalksFocusEnabled
|
|
121
|
-
});
|
|
122
|
-
expect(crosswalks.at(1).props()).toEqual({
|
|
123
|
-
crosswalk: {
|
|
124
|
-
uri: 'entities/2/crosswalks/1',
|
|
125
|
-
value: '123',
|
|
126
|
-
type: 'configuration/sources/FB'
|
|
127
|
-
},
|
|
128
|
-
isEmpty: true,
|
|
129
|
-
disableEdit: props.disableEditCrosswalk,
|
|
130
|
-
disableDelete: props.disableDeleteCrosswalk,
|
|
131
|
-
onDelete: props.onDelete,
|
|
132
|
-
onEdit: props.onEdit,
|
|
133
|
-
isColored: props.showCrosswalkColors,
|
|
134
|
-
focusable: props.crosswalksFocusEnabled
|
|
135
|
-
});
|
|
136
|
-
expect(wrapper.find(ShowDependentLink)).toHaveLength(0);
|
|
138
|
+
setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes }));
|
|
139
|
+
var blocks = screen.getAllByTestId('cw-colored-block');
|
|
140
|
+
expect(within(blocks[0]).getByText('Facebook')).toBeInTheDocument();
|
|
141
|
+
expect(within(blocks[0]).getByText('456')).toBeInTheDocument();
|
|
142
|
+
expect(within(blocks[1]).getByText('Reltio')).toBeInTheDocument();
|
|
143
|
+
expect(within(blocks[1]).getByText('123')).toBeInTheDocument();
|
|
137
144
|
});
|
|
138
|
-
it('should disable editing in CrosswalkRow if props.disableEditCrosswalk = true', function () {
|
|
139
|
-
var crosswalksByTypes
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
145
|
+
it('should disable editing in CrosswalkRow if props.disableEditCrosswalk = true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
146
|
+
var crosswalksByTypes, user;
|
|
147
|
+
return __generator(this, function (_a) {
|
|
148
|
+
switch (_a.label) {
|
|
149
|
+
case 0:
|
|
150
|
+
crosswalksByTypes = {
|
|
151
|
+
empty: [
|
|
152
|
+
{
|
|
153
|
+
uri: 'entities/2/crosswalks/1',
|
|
154
|
+
value: '123',
|
|
155
|
+
type: 'configuration/sources/FB'
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
simple: [
|
|
159
|
+
{
|
|
160
|
+
uri: 'entities/2/crosswalks/2',
|
|
161
|
+
value: '456',
|
|
162
|
+
type: 'configuration/sources/FB'
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
dependent: []
|
|
166
|
+
};
|
|
167
|
+
user = setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, disableEditCrosswalk: true })).user;
|
|
168
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('arrow-expand-button')[0])];
|
|
169
|
+
case 1:
|
|
170
|
+
_a.sent();
|
|
171
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('arrow-expand-button')[1])];
|
|
172
|
+
case 2:
|
|
173
|
+
_a.sent();
|
|
174
|
+
expect(screen.queryByText('Add attributes')).not.toBeInTheDocument();
|
|
175
|
+
return [2 /*return*/];
|
|
176
|
+
}
|
|
159
177
|
});
|
|
160
|
-
});
|
|
161
|
-
it('should disable deleting in CrosswalkRow if props.disableDeleteCrosswalk = true', function () {
|
|
162
|
-
var crosswalksByTypes
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
}); });
|
|
179
|
+
it('should disable deleting in CrosswalkRow if props.disableDeleteCrosswalk = true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
180
|
+
var crosswalksByTypes, user;
|
|
181
|
+
return __generator(this, function (_a) {
|
|
182
|
+
switch (_a.label) {
|
|
183
|
+
case 0:
|
|
184
|
+
crosswalksByTypes = {
|
|
185
|
+
empty: [
|
|
186
|
+
{
|
|
187
|
+
uri: 'entities/2/crosswalks/1',
|
|
188
|
+
value: '123',
|
|
189
|
+
type: 'configuration/sources/FB'
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
simple: [
|
|
193
|
+
{
|
|
194
|
+
uri: 'entities/2/crosswalks/2',
|
|
195
|
+
value: '456',
|
|
196
|
+
type: 'configuration/sources/FB'
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
dependent: []
|
|
200
|
+
};
|
|
201
|
+
user = setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, disableDeleteCrosswalk: true })).user;
|
|
202
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('arrow-expand-button')[0])];
|
|
203
|
+
case 1:
|
|
204
|
+
_a.sent();
|
|
205
|
+
expect(within(screen.getByLabelText("You don't have permissions to delete")).getByRole('button')).toBeDisabled();
|
|
206
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('arrow-expand-button')[0])];
|
|
207
|
+
case 2:
|
|
208
|
+
_a.sent();
|
|
209
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('arrow-expand-button')[1])];
|
|
210
|
+
case 3:
|
|
211
|
+
_a.sent();
|
|
212
|
+
expect(within(screen.getByLabelText("You don't have permissions to delete")).getByRole('button')).toBeDisabled();
|
|
213
|
+
return [2 /*return*/];
|
|
214
|
+
}
|
|
182
215
|
});
|
|
183
|
-
});
|
|
216
|
+
}); });
|
|
184
217
|
it('should not color crosswalks if props.showCrosswalkColors if false', function () {
|
|
185
218
|
var crosswalksByTypes = {
|
|
186
219
|
empty: [
|
|
@@ -199,10 +232,10 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
199
232
|
],
|
|
200
233
|
dependent: []
|
|
201
234
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
235
|
+
setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, expanded: true, showCrosswalkColors: false }));
|
|
236
|
+
var coloredBlocks = screen.getAllByTestId('cw-colored-block');
|
|
237
|
+
expect(getComputedStyle(coloredBlocks[0]).backgroundColor).toBe('rgb(202, 204, 209)');
|
|
238
|
+
expect(getComputedStyle(coloredBlocks[1]).backgroundColor).toBe('rgb(255, 255, 255)');
|
|
206
239
|
});
|
|
207
240
|
it('should expand crosswalks if highlighted crosswalks contains dependent crosswalk', function () {
|
|
208
241
|
var dependentCrosswalk = {
|
|
@@ -227,10 +260,10 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
227
260
|
],
|
|
228
261
|
dependent: [dependentCrosswalk]
|
|
229
262
|
};
|
|
230
|
-
var
|
|
231
|
-
expect(
|
|
263
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, crosswalksFocusEnabled: true })).rerender;
|
|
264
|
+
expect(defaultProps.onToggleExpanded).not.toHaveBeenCalled();
|
|
232
265
|
useHighlightedCrosswalksMock.mockReturnValueOnce([dependentCrosswalk]);
|
|
233
|
-
|
|
234
|
-
expect(
|
|
266
|
+
rerender(React.createElement(SourceCrosswalksRow, __assign({}, defaultProps, { crosswalksByTypes: crosswalksByTypes, crosswalksFocusEnabled: true, expanded: false })));
|
|
267
|
+
expect(defaultProps.onToggleExpanded).toHaveBeenCalled();
|
|
235
268
|
});
|
|
236
269
|
});
|
package/package.json
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMetadata = exports.createEntity = void 0;
|
|
4
|
-
var createEntity = function () {
|
|
5
|
-
return {
|
|
6
|
-
uri: 'entities/01L2n5z',
|
|
7
|
-
type: 'configuration/entityTypes/HCP',
|
|
8
|
-
label: 'entity label',
|
|
9
|
-
attributes: {
|
|
10
|
-
Boolean: [
|
|
11
|
-
{
|
|
12
|
-
ov: true,
|
|
13
|
-
type: 'configuration/entityTypes/HCP/attributes/Boolean',
|
|
14
|
-
uri: 'entities/01L2n5z/attributes/Boolean/5nmc3Cp',
|
|
15
|
-
value: 'true'
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
TextField: [
|
|
19
|
-
{
|
|
20
|
-
ov: true,
|
|
21
|
-
type: 'configuration/entityTypes/HCP/attributes/TextField',
|
|
22
|
-
uri: 'entities/01L2n5z/attributes/TextField/5noU1aB',
|
|
23
|
-
value: 'text field value'
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
crosswalks: [
|
|
28
|
-
{
|
|
29
|
-
attributes: [
|
|
30
|
-
'entities/01L2n5z/attributes/TextField/5noU1aB',
|
|
31
|
-
'entities/01L2n5z/attributes/Boolean/5nmc3Cp'
|
|
32
|
-
],
|
|
33
|
-
type: 'configuration/sources/Reltio',
|
|
34
|
-
uri: 'entities/01L2n5z/crosswalks/7F10sMx',
|
|
35
|
-
value: '01L2n5z'
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
exports.createEntity = createEntity;
|
|
41
|
-
var createMetadata = function () {
|
|
42
|
-
return {
|
|
43
|
-
entityTypes: [],
|
|
44
|
-
sources: [
|
|
45
|
-
{
|
|
46
|
-
uri: 'configuration/sources/Reltio',
|
|
47
|
-
label: 'Reltio'
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
exports.createMetadata = createMetadata;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|