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