@reltio/components 1.4.2070 → 1.4.2071
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/FacetViewHeader/FacetViewHeader.js +1 -1
- package/ImageAttributesLine/imageAttributeValues.test-data.js +8 -0
- package/ImageAttributesLine/index.d.ts +1 -1
- package/ImageAttributesLine/index.js +1 -1
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +1 -1
- package/MergeButton/MergeButton.spec.js +55 -124
- package/MetadataTypesSelector/MetadataTypesSelector.js +1 -1
- package/MetadataTypesSelector/MetadataTypesSelector.test.js +193 -190
- package/MoreAttributesButton/MoreAttributesButton.test.js +173 -166
- package/MultiValueSelector/MultiValueSelector.test.js +78 -38
- package/MultipliableSelect/MultipliableSelect.test.js +111 -47
- package/NestedAttribute/NestedAttribute.test.js +121 -42
- package/NestedAttributeEditor/NestedAttributeEditor.test.js +95 -41
- package/NotMatchButton/NotMatchButton.spec.js +51 -100
- package/PieChart/PieChart.test.js +130 -114
- package/PinButton/PinButton.spec.js +89 -22
- package/PivotingTooltip/PivotingTooltip.test.js +338 -174
- package/PotentialMatchReviewCard/PotentialMatchReviewCard.spec.js +94 -29
- package/ProfileBand/ProfileBand.spec.js +60 -53
- package/ProfileCard/ProfileCard.test.js +109 -27
- package/ProfilesList/ProfilesList.d.ts +1 -3
- package/ProfilesList/ProfilesList.js +1 -1
- package/ProfilesList/ProfilesList.spec.js +226 -211
- package/QueryBuilderRow/QueryBuilderRow.spec.js +83 -90
- package/QueryBuilderRowsGroup/QueryBuilderRowsGroup.spec.js +195 -86
- package/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +73 -15
- package/ReactSelectMenuWithPopper/ReactSelectMenuWithPopper.test.js +71 -117
- package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +128 -61
- package/ReadOnlyAttributesFactory/components/ReadOnlyAttribute/ReadOnlyAttribute.test.js +179 -44
- package/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +254 -211
- package/ReadOnlyAttributesList/attributes.test-data.js +4 -4
- package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +75 -18
- package/ReadOnlyAttributesView/ReadOnlyAttributesView.test.js +187 -312
- package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +210 -219
- package/ReadOnlyImageAttributesLine/ReadOnlyImageAttributesLine.test.js +89 -89
- package/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +556 -602
- package/ReferenceAttributeEditor/metadata.test-data.d.ts +13 -13
- package/ReferenceAttributeEditor/metadata.test-data.js +2 -2
- package/ReferenceAttributeEditor/styles.d.ts +1 -1
- package/RelationEditor/RelationEditor.test.js +1448 -1392
- package/RelationTypeSelector/RelationTypeSelector.test.js +99 -17
- package/RelationTypesSelector/RelationTypesSelector.test.js +73 -22
- package/ReltioMap/ReltioMap.spec.js +51 -25
- package/Roles/Roles.test.js +54 -10
- package/ScreenProfileBand/ScreenProfileBand.test.js +142 -72
- package/cjs/FacetViewHeader/FacetViewHeader.js +1 -1
- package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +8 -0
- package/cjs/ImageAttributesLine/index.d.ts +1 -1
- package/cjs/ImageAttributesLine/index.js +2 -1
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +1 -1
- package/cjs/MergeButton/MergeButton.spec.js +55 -124
- package/cjs/MetadataTypesSelector/MetadataTypesSelector.js +1 -1
- package/cjs/MetadataTypesSelector/MetadataTypesSelector.test.js +193 -190
- package/cjs/MoreAttributesButton/MoreAttributesButton.test.js +172 -165
- package/cjs/MultiValueSelector/MultiValueSelector.test.js +78 -38
- package/cjs/MultipliableSelect/MultipliableSelect.test.js +111 -47
- package/cjs/NestedAttribute/NestedAttribute.test.js +121 -42
- package/cjs/NestedAttributeEditor/NestedAttributeEditor.test.js +94 -40
- package/cjs/NotMatchButton/NotMatchButton.spec.js +51 -100
- package/cjs/PieChart/PieChart.test.js +130 -114
- package/cjs/PinButton/PinButton.spec.js +89 -22
- package/cjs/PivotingTooltip/PivotingTooltip.test.js +338 -174
- package/cjs/PotentialMatchReviewCard/PotentialMatchReviewCard.spec.js +94 -29
- package/cjs/ProfileBand/ProfileBand.spec.js +60 -53
- package/cjs/ProfileCard/ProfileCard.test.js +109 -27
- package/cjs/ProfilesList/ProfilesList.d.ts +1 -3
- package/cjs/ProfilesList/ProfilesList.js +1 -1
- package/cjs/ProfilesList/ProfilesList.spec.js +226 -211
- package/cjs/QueryBuilderRow/QueryBuilderRow.spec.js +83 -90
- package/cjs/QueryBuilderRowsGroup/QueryBuilderRowsGroup.spec.js +195 -86
- package/cjs/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +73 -15
- package/cjs/ReactSelectMenuWithPopper/ReactSelectMenuWithPopper.test.js +71 -117
- package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +128 -61
- package/cjs/ReadOnlyAttributesFactory/components/ReadOnlyAttribute/ReadOnlyAttribute.test.js +179 -44
- package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +254 -211
- package/cjs/ReadOnlyAttributesList/attributes.test-data.js +4 -4
- package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +75 -18
- package/cjs/ReadOnlyAttributesView/ReadOnlyAttributesView.test.js +185 -310
- package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +209 -218
- package/cjs/ReadOnlyImageAttributesLine/ReadOnlyImageAttributesLine.test.js +89 -89
- package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +555 -601
- package/cjs/ReferenceAttributeEditor/metadata.test-data.d.ts +13 -13
- package/cjs/ReferenceAttributeEditor/metadata.test-data.js +2 -2
- package/cjs/ReferenceAttributeEditor/styles.d.ts +1 -1
- package/cjs/RelationEditor/RelationEditor.test.js +1446 -1390
- package/cjs/RelationTypeSelector/RelationTypeSelector.test.js +99 -17
- package/cjs/RelationTypesSelector/RelationTypesSelector.test.js +73 -22
- package/cjs/ReltioMap/ReltioMap.spec.js +51 -25
- package/cjs/Roles/Roles.test.js +54 -10
- package/cjs/ScreenProfileBand/ScreenProfileBand.test.js +141 -71
- package/package.json +1 -1
- package/MetadataTypesSelector/components/ListLabel/ListLabel.test.d.ts +0 -1
- package/MetadataTypesSelector/components/ListLabel/ListLabel.test.js +0 -24
- package/PivotingTooltip/IntegrationPivotingTooltip.test.d.ts +0 -1
- package/PivotingTooltip/IntegrationPivotingTooltip.test.js +0 -356
- package/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.d.ts +0 -1
- package/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +0 -201
- package/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.d.ts +0 -1
- package/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.js +0 -43
- package/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.d.ts +0 -1
- package/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.js +0 -31
- package/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.d.ts +0 -1
- package/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.js +0 -31
- package/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
- package/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -45
- package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.d.ts +0 -1
- package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.js +0 -114
- package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.d.ts +0 -1
- package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.js +0 -107
- package/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
- package/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -72
- package/RelationEditor/IntegrationRelationEditor.test.d.ts +0 -1
- package/RelationEditor/IntegrationRelationEditor.test.js +0 -337
- package/ReltioMap/components/MapControlContainer/MapControlContainer.d.ts +0 -10
- package/ReltioMap/components/MapControlContainer/MapControlContainer.js +0 -24
- package/ReltioMap/components/MapControlContainer/MapControlContainer.spec.d.ts +0 -1
- package/ReltioMap/components/MapControlContainer/MapControlContainer.spec.js +0 -33
- package/ReltioMap/components/MapControlContainer/index.d.ts +0 -1
- package/ReltioMap/components/MapControlContainer/index.js +0 -1
- package/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.d.ts +0 -1
- package/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.js +0 -36
- package/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.d.ts +0 -1
- package/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.js +0 -60
- package/Roles/components/Role/Role.test.d.ts +0 -1
- package/Roles/components/Role/Role.test.js +0 -55
- package/cjs/MetadataTypesSelector/components/ListLabel/ListLabel.test.d.ts +0 -1
- package/cjs/MetadataTypesSelector/components/ListLabel/ListLabel.test.js +0 -52
- package/cjs/PivotingTooltip/IntegrationPivotingTooltip.test.d.ts +0 -1
- package/cjs/PivotingTooltip/IntegrationPivotingTooltip.test.js +0 -361
- package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.d.ts +0 -1
- package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +0 -206
- package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.d.ts +0 -1
- package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.js +0 -48
- package/cjs/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.d.ts +0 -1
- package/cjs/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.js +0 -36
- package/cjs/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.d.ts +0 -1
- package/cjs/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.js +0 -36
- package/cjs/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
- package/cjs/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -50
- package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.d.ts +0 -1
- package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.js +0 -119
- package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.d.ts +0 -1
- package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.js +0 -112
- package/cjs/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
- package/cjs/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -77
- package/cjs/RelationEditor/IntegrationRelationEditor.test.d.ts +0 -1
- package/cjs/RelationEditor/IntegrationRelationEditor.test.js +0 -342
- package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.d.ts +0 -10
- package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.js +0 -28
- package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.spec.d.ts +0 -1
- package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.spec.js +0 -38
- package/cjs/ReltioMap/components/MapControlContainer/index.d.ts +0 -1
- package/cjs/ReltioMap/components/MapControlContainer/index.js +0 -5
- package/cjs/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.d.ts +0 -1
- package/cjs/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.js +0 -41
- package/cjs/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.d.ts +0 -1
- package/cjs/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.js +0 -65
- package/cjs/Roles/components/Role/Role.test.d.ts +0 -1
- package/cjs/Roles/components/Role/Role.test.js +0 -60
|
@@ -1,20 +1,102 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
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);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
1
37
|
import React from 'react';
|
|
2
|
-
import {
|
|
38
|
+
import { render, screen, within } from '@testing-library/react';
|
|
39
|
+
import userEvent from '@testing-library/user-event';
|
|
3
40
|
import { RelationTypeSelector } from './RelationTypeSelector';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
41
|
+
describe('Relation type selector tests', function () {
|
|
42
|
+
it('should render and work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var user, firstValue, secondValue, options, onChange, items;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
switch (_a.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
user = userEvent.setup();
|
|
48
|
+
firstValue = {
|
|
49
|
+
label: 'Orange',
|
|
50
|
+
value: 'orange',
|
|
51
|
+
startObject: {
|
|
52
|
+
objectTypeURI: '',
|
|
53
|
+
uri: '',
|
|
54
|
+
objectType: { uri: 'configuration/entityTypes/HCP', label: 'HCP' }
|
|
55
|
+
},
|
|
56
|
+
endObject: {
|
|
57
|
+
objectTypeURI: '',
|
|
58
|
+
uri: '',
|
|
59
|
+
objectType: { uri: 'configuration/entityTypes/Company', label: 'Company' }
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
secondValue = {
|
|
63
|
+
label: 'Apple',
|
|
64
|
+
value: 'apple',
|
|
65
|
+
startObject: {
|
|
66
|
+
objectTypeURI: '',
|
|
67
|
+
uri: '',
|
|
68
|
+
objectType: { uri: 'configuration/entityTypes/HCA', label: 'HCA' }
|
|
69
|
+
},
|
|
70
|
+
endObject: {
|
|
71
|
+
objectTypeURI: '',
|
|
72
|
+
uri: '',
|
|
73
|
+
objectType: { uri: 'configuration/entityTypes/Individual', label: 'Individual' }
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
options = [firstValue, secondValue];
|
|
77
|
+
onChange = jest.fn();
|
|
78
|
+
render(React.createElement(RelationTypeSelector, { value: firstValue, options: options, onChange: onChange }));
|
|
79
|
+
screen.getByText('Select relationship type');
|
|
80
|
+
screen.getByText('Orange');
|
|
81
|
+
return [4 /*yield*/, user.click(screen.getByRole('combobox'))];
|
|
82
|
+
case 1:
|
|
83
|
+
_a.sent();
|
|
84
|
+
items = screen.getAllByRole('option');
|
|
85
|
+
expect(items).toHaveLength(2);
|
|
86
|
+
within(items[0]).getByText('H');
|
|
87
|
+
within(items[0]).getByText('C');
|
|
88
|
+
within(items[0]).getByText('Orange');
|
|
89
|
+
within(items[0]).getByText('HCP ↔ Company');
|
|
90
|
+
within(items[1]).getByText('H');
|
|
91
|
+
within(items[1]).getByText('I');
|
|
92
|
+
within(items[1]).getByText('Apple');
|
|
93
|
+
within(items[1]).getByText('HCA ↔ Individual');
|
|
94
|
+
return [4 /*yield*/, user.click(items[1])];
|
|
95
|
+
case 2:
|
|
96
|
+
_a.sent();
|
|
97
|
+
expect(onChange).toHaveBeenCalledWith(secondValue, { action: 'select-option' });
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); });
|
|
20
102
|
});
|
|
@@ -1,26 +1,77 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
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);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
1
37
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
38
|
+
import { render, screen } from '@testing-library/react';
|
|
39
|
+
import userEvent from '@testing-library/user-event';
|
|
4
40
|
import { RelationTypesSelector } from './RelationTypesSelector';
|
|
5
|
-
describe('
|
|
6
|
-
it('should filter items correctly', function () {
|
|
7
|
-
var relationTypes
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
41
|
+
describe('Relation types selector tests', function () {
|
|
42
|
+
it('should filter items correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var user, relationTypes, onChange, items;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
switch (_a.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
user = userEvent.setup();
|
|
48
|
+
relationTypes = [
|
|
49
|
+
{
|
|
50
|
+
access: ['READ'],
|
|
51
|
+
uri: 'configuration/relationTypes/PharmacyProvider',
|
|
52
|
+
label: 'Pharmacy Provider',
|
|
53
|
+
attributes: []
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
access: [],
|
|
57
|
+
uri: 'configuration/relationTypes/Parent',
|
|
58
|
+
abstract: true,
|
|
59
|
+
attributes: [],
|
|
60
|
+
label: 'Parent'
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
onChange = jest.fn();
|
|
64
|
+
render(React.createElement(RelationTypesSelector, { relationTypes: relationTypes, selectedRelationTypes: [], onChange: onChange }));
|
|
65
|
+
screen.getByText('Relation type');
|
|
66
|
+
return [4 /*yield*/, user.click(screen.getByRole('textbox'))];
|
|
67
|
+
case 1:
|
|
68
|
+
_a.sent();
|
|
69
|
+
screen.getByText('Select relation types');
|
|
70
|
+
items = screen.getAllByRole('menuitem');
|
|
71
|
+
expect(items).toHaveLength(1);
|
|
72
|
+
expect(items[0]).toHaveTextContent('Pharmacy Provider');
|
|
73
|
+
return [2 /*return*/];
|
|
20
74
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var component = shallow(React.createElement(RelationTypesSelector, { relationTypes: relationTypes, selectedRelationTypes: [], onChange: onChange }));
|
|
24
|
-
expect(component.find(MetadataTypesSelector).prop('items')).toEqual([relationTypes[0]]);
|
|
25
|
-
});
|
|
75
|
+
});
|
|
76
|
+
}); });
|
|
26
77
|
});
|
|
@@ -76,7 +76,7 @@ describe('ReltioMap tests', function () {
|
|
|
76
76
|
mapKey: 'mapKey',
|
|
77
77
|
loadingElement: React.createElement("div", null, "loading element")
|
|
78
78
|
};
|
|
79
|
-
var
|
|
79
|
+
var setUp = function (props) {
|
|
80
80
|
if (props === void 0) { props = defaultProps; }
|
|
81
81
|
var user = userEvent.setup();
|
|
82
82
|
return __assign(__assign({}, render(React.createElement(ReltioMap, __assign({}, props)))), { user: user });
|
|
@@ -148,7 +148,7 @@ describe('ReltioMap tests', function () {
|
|
|
148
148
|
return __generator(this, function (_b) {
|
|
149
149
|
switch (_b.label) {
|
|
150
150
|
case 0:
|
|
151
|
-
|
|
151
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON] }));
|
|
152
152
|
_a = expect;
|
|
153
153
|
return [4 /*yield*/, screen.findByLabelText('Draw area')];
|
|
154
154
|
case 1:
|
|
@@ -164,7 +164,7 @@ describe('ReltioMap tests', function () {
|
|
|
164
164
|
switch (_a.label) {
|
|
165
165
|
case 0:
|
|
166
166
|
mapOptions = { mapTypeControl: true };
|
|
167
|
-
|
|
167
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], mapOptions: mapOptions }));
|
|
168
168
|
return [4 /*yield*/, waitFor(function () {
|
|
169
169
|
expect(google.maps.Map).toHaveBeenCalledWith(expect.any(HTMLElement), expect.objectContaining({
|
|
170
170
|
fullscreenControl: false,
|
|
@@ -182,7 +182,7 @@ describe('ReltioMap tests', function () {
|
|
|
182
182
|
return __generator(this, function (_a) {
|
|
183
183
|
switch (_a.label) {
|
|
184
184
|
case 0:
|
|
185
|
-
|
|
185
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], isSearchEnabled: false }));
|
|
186
186
|
return [4 /*yield*/, waitFor(function () {
|
|
187
187
|
expect(screen.queryByLabelText('Draw area')).not.toBeInTheDocument();
|
|
188
188
|
})];
|
|
@@ -208,7 +208,7 @@ describe('ReltioMap tests', function () {
|
|
|
208
208
|
}
|
|
209
209
|
];
|
|
210
210
|
onMarkerClick = jest.fn();
|
|
211
|
-
|
|
211
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], onMarkerClicked: onMarkerClick, markers: markers }));
|
|
212
212
|
return [4 /*yield*/, waitFor(function () {
|
|
213
213
|
markerMock = getLastInstance(AdvancedMarkerElement);
|
|
214
214
|
expect(markerMock).toBeDefined();
|
|
@@ -226,7 +226,7 @@ describe('ReltioMap tests', function () {
|
|
|
226
226
|
it('should fit map bounds correctly if markers loaded later than map', function () {
|
|
227
227
|
var fitMapBoundsForMarkers = jest.spyOn(helpers, 'fitMapBoundsForMarkers');
|
|
228
228
|
var fitMapBoundsForOverlay = jest.spyOn(helpers, 'fitMapBoundsForOverlay');
|
|
229
|
-
var rerender =
|
|
229
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { markers: [] })).rerender;
|
|
230
230
|
expect(fitMapBoundsForMarkers).not.toHaveBeenCalled();
|
|
231
231
|
expect(fitMapBoundsForOverlay).not.toHaveBeenCalled();
|
|
232
232
|
var newProps = __assign(__assign({}, defaultProps), { markers: [
|
|
@@ -260,7 +260,7 @@ describe('ReltioMap tests', function () {
|
|
|
260
260
|
};
|
|
261
261
|
var fitMapBoundsForMarkers = jest.spyOn(helpers, 'fitMapBoundsForMarkers');
|
|
262
262
|
var fitMapBoundsForOverlay = jest.spyOn(helpers, 'fitMapBoundsForOverlay');
|
|
263
|
-
var rerender =
|
|
263
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { markers: [], activeOverlay: activeOverlay })).rerender;
|
|
264
264
|
expect(fitMapBoundsForMarkers).not.toHaveBeenCalled();
|
|
265
265
|
expect(fitMapBoundsForOverlay).not.toHaveBeenCalledWith(activeOverlay);
|
|
266
266
|
var newProps = __assign(__assign({}, defaultProps), { activeOverlay: activeOverlay, markers: [
|
|
@@ -287,7 +287,7 @@ describe('ReltioMap tests', function () {
|
|
|
287
287
|
it('should not fit map bounds when markers changed and "Search when I move the map" mode is on', function () {
|
|
288
288
|
var fitMapBoundsForMarkers = jest.spyOn(helpers, 'fitMapBoundsForMarkers');
|
|
289
289
|
var fitMapBoundsForOverlay = jest.spyOn(helpers, 'fitMapBoundsForOverlay');
|
|
290
|
-
var rerender =
|
|
290
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { isSearchOnMapMove: false, markers: [] })).rerender;
|
|
291
291
|
var newProps = __assign(__assign({}, defaultProps), { isSearchOnMapMove: true, markers: [
|
|
292
292
|
{
|
|
293
293
|
point: { lat: 1, lng: 1 },
|
|
@@ -311,7 +311,7 @@ describe('ReltioMap tests', function () {
|
|
|
311
311
|
it('should fit map bounds when activeOverlay changed', function () {
|
|
312
312
|
var fitMapBoundsForMarkers = jest.spyOn(helpers, 'fitMapBoundsForMarkers');
|
|
313
313
|
var fitMapBoundsForOverlay = jest.spyOn(helpers, 'fitMapBoundsForOverlay');
|
|
314
|
-
var rerender =
|
|
314
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { activeOverlay: null })).rerender;
|
|
315
315
|
var newProps = __assign(__assign({}, defaultProps), { activeOverlay: {
|
|
316
316
|
type: MAP_DRAWING_MODES.POLYGON,
|
|
317
317
|
path: [
|
|
@@ -328,7 +328,7 @@ describe('ReltioMap tests', function () {
|
|
|
328
328
|
it('should run fit map bounds only once when activeOverlay and markers are changed simultaneously', function () {
|
|
329
329
|
var fitMapBoundsForMarkers = jest.spyOn(helpers, 'fitMapBoundsForMarkers');
|
|
330
330
|
var fitMapBoundsForOverlay = jest.spyOn(helpers, 'fitMapBoundsForOverlay');
|
|
331
|
-
var rerender =
|
|
331
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { activeOverlay: null })).rerender;
|
|
332
332
|
var newProps = __assign(__assign({}, defaultProps), { activeOverlay: {
|
|
333
333
|
type: MAP_DRAWING_MODES.POLYGON,
|
|
334
334
|
path: [
|
|
@@ -358,7 +358,7 @@ describe('ReltioMap tests', function () {
|
|
|
358
358
|
expect(fitMapBoundsForMarkers).toHaveBeenCalledWith(newProps.markers, mapMock, newProps.activeOverlay);
|
|
359
359
|
});
|
|
360
360
|
it('should align zoom level when fit map bounds for single marker', function () {
|
|
361
|
-
var rerender =
|
|
361
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { activeOverlay: null })).rerender;
|
|
362
362
|
var newProps = __assign(__assign({}, defaultProps), { markers: [
|
|
363
363
|
{
|
|
364
364
|
point: { lat: 1, lng: 1 },
|
|
@@ -387,7 +387,7 @@ describe('ReltioMap tests', function () {
|
|
|
387
387
|
{ lat: 2, lng: 2 }
|
|
388
388
|
]
|
|
389
389
|
};
|
|
390
|
-
_a =
|
|
390
|
+
_a = setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], activeOverlay: activeOverlay })), user = _a.user, rerender = _a.rerender;
|
|
391
391
|
polygon = getLastInstance(Polygon);
|
|
392
392
|
expect(polygon.setOptions).toHaveBeenCalledWith(expect.objectContaining({ paths: activeOverlay.path }));
|
|
393
393
|
newProps = __assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], activeOverlay: null });
|
|
@@ -409,7 +409,7 @@ describe('ReltioMap tests', function () {
|
|
|
409
409
|
type: MAP_DRAWING_MODES.CIRCLE,
|
|
410
410
|
path: [{ lat: 1, lng: 1 }]
|
|
411
411
|
};
|
|
412
|
-
|
|
412
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], activeOverlay: activeOverlay }));
|
|
413
413
|
return [4 /*yield*/, waitFor(function () {
|
|
414
414
|
expect(mockInstances.get(Polygon)).toHaveLength(0);
|
|
415
415
|
})];
|
|
@@ -432,7 +432,7 @@ describe('ReltioMap tests', function () {
|
|
|
432
432
|
]
|
|
433
433
|
};
|
|
434
434
|
onOverlayUpdated = jest.fn();
|
|
435
|
-
|
|
435
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], activeOverlay: activeOverlay, onOverlayUpdated: onOverlayUpdated }));
|
|
436
436
|
polygon = getLastInstance(Polygon);
|
|
437
437
|
getEventHandler(polygon, 'mouseup')();
|
|
438
438
|
return [4 /*yield*/, waitFor(function () {
|
|
@@ -461,7 +461,7 @@ describe('ReltioMap tests', function () {
|
|
|
461
461
|
]
|
|
462
462
|
};
|
|
463
463
|
onOverlayUpdated = jest.fn();
|
|
464
|
-
|
|
464
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.POLYGON], activeOverlay: activeOverlay, onOverlayUpdated: onOverlayUpdated }));
|
|
465
465
|
polygon = getLastInstance(Polygon);
|
|
466
466
|
getEventHandler(polygon, 'dragend')();
|
|
467
467
|
return [4 /*yield*/, waitFor(function () {
|
|
@@ -483,7 +483,7 @@ describe('ReltioMap tests', function () {
|
|
|
483
483
|
return __generator(this, function (_a) {
|
|
484
484
|
switch (_a.label) {
|
|
485
485
|
case 0:
|
|
486
|
-
|
|
486
|
+
setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.CIRCLE] }));
|
|
487
487
|
return [4 /*yield*/, waitFor(function () {
|
|
488
488
|
expect(drawingManagerInstance).not.toBe(null);
|
|
489
489
|
})];
|
|
@@ -499,11 +499,15 @@ describe('ReltioMap tests', function () {
|
|
|
499
499
|
return __generator(this, function (_a) {
|
|
500
500
|
switch (_a.label) {
|
|
501
501
|
case 0:
|
|
502
|
-
user =
|
|
502
|
+
user = setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.CIRCLE] })).user;
|
|
503
503
|
return [4 /*yield*/, user.click(screen.getByLabelText('Draw area'))];
|
|
504
504
|
case 1:
|
|
505
505
|
_a.sent();
|
|
506
506
|
expect(drawingManagerConstructorSpy).toHaveBeenCalledWith(expect.objectContaining({ drawingMode: MAP_DRAWING_MODES.CIRCLE }));
|
|
507
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Clear area'))];
|
|
508
|
+
case 2:
|
|
509
|
+
_a.sent();
|
|
510
|
+
expect(drawingManagerConstructorSpy).toHaveBeenCalledWith(expect.objectContaining({ drawingMode: null }));
|
|
507
511
|
return [2 /*return*/];
|
|
508
512
|
}
|
|
509
513
|
});
|
|
@@ -512,7 +516,7 @@ describe('ReltioMap tests', function () {
|
|
|
512
516
|
return __generator(this, function (_a) {
|
|
513
517
|
switch (_a.label) {
|
|
514
518
|
case 0:
|
|
515
|
-
|
|
519
|
+
setUp(__assign({}, defaultProps));
|
|
516
520
|
return [4 /*yield*/, waitFor(function () {
|
|
517
521
|
expect(drawingManagerInstance).toBe(null);
|
|
518
522
|
})];
|
|
@@ -526,7 +530,7 @@ describe('ReltioMap tests', function () {
|
|
|
526
530
|
return __generator(this, function (_a) {
|
|
527
531
|
switch (_a.label) {
|
|
528
532
|
case 0:
|
|
529
|
-
|
|
533
|
+
setUp(__assign({}, defaultProps));
|
|
530
534
|
return [4 /*yield*/, waitFor(function () {
|
|
531
535
|
expect(screen.queryByLabelText('Draw area')).not.toBeInTheDocument();
|
|
532
536
|
})];
|
|
@@ -543,7 +547,7 @@ describe('ReltioMap tests', function () {
|
|
|
543
547
|
switch (_a.label) {
|
|
544
548
|
case 0:
|
|
545
549
|
onOverlayUpdated = jest.fn();
|
|
546
|
-
user =
|
|
550
|
+
user = setUp(__assign(__assign({}, defaultProps), { onOverlayUpdated: onOverlayUpdated, drawingModes: [MAP_DRAWING_MODES.POLYGON] })).user;
|
|
547
551
|
return [4 /*yield*/, user.click(screen.getByLabelText('Draw area'))];
|
|
548
552
|
case 1:
|
|
549
553
|
_a.sent();
|
|
@@ -573,6 +577,28 @@ describe('ReltioMap tests', function () {
|
|
|
573
577
|
}
|
|
574
578
|
});
|
|
575
579
|
}); });
|
|
580
|
+
it('should call props.onOverlayUpdated on "Clear area" button correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
581
|
+
var onOverlayUpdated, activeOverlay, user;
|
|
582
|
+
return __generator(this, function (_a) {
|
|
583
|
+
switch (_a.label) {
|
|
584
|
+
case 0:
|
|
585
|
+
onOverlayUpdated = jest.fn();
|
|
586
|
+
activeOverlay = {
|
|
587
|
+
type: MAP_DRAWING_MODES.POLYGON,
|
|
588
|
+
path: [
|
|
589
|
+
{ lat: 1, lng: 1 },
|
|
590
|
+
{ lat: 2, lng: 2 }
|
|
591
|
+
]
|
|
592
|
+
};
|
|
593
|
+
user = setUp(__assign(__assign({}, defaultProps), { drawingModes: [MAP_DRAWING_MODES.CIRCLE], activeOverlay: activeOverlay, onOverlayUpdated: onOverlayUpdated })).user;
|
|
594
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Clear area'))];
|
|
595
|
+
case 1:
|
|
596
|
+
_a.sent();
|
|
597
|
+
expect(onOverlayUpdated).toHaveBeenCalledWith(null);
|
|
598
|
+
return [2 /*return*/];
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}); });
|
|
576
602
|
});
|
|
577
603
|
describe('"Search when I move the map" behavior', function () {
|
|
578
604
|
it('should call props.onMapBoundsChanged with current map bounds and reset drawingMode on change isSearchOnMapMove(true)', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -585,7 +611,7 @@ describe('ReltioMap tests', function () {
|
|
|
585
611
|
[1, 2],
|
|
586
612
|
[3, 4]
|
|
587
613
|
];
|
|
588
|
-
user =
|
|
614
|
+
user = setUp(__assign(__assign({}, defaultProps), { onMapBoundsChanged: onMapBoundsChanged, drawingModes: [MAP_DRAWING_MODES.POLYGON] })).user;
|
|
589
615
|
jest.spyOn(helpers, 'getMapBoundsPolygon').mockImplementation(function () { return mapBoundsPolygon; });
|
|
590
616
|
return [4 /*yield*/, user.click(screen.getByLabelText('Draw area'))];
|
|
591
617
|
case 1:
|
|
@@ -606,7 +632,7 @@ describe('ReltioMap tests', function () {
|
|
|
606
632
|
switch (_a.label) {
|
|
607
633
|
case 0:
|
|
608
634
|
onMapBoundsChanged = jest.fn();
|
|
609
|
-
user =
|
|
635
|
+
user = setUp(__assign(__assign({}, defaultProps), { onMapBoundsChanged: onMapBoundsChanged, drawingModes: [MAP_DRAWING_MODES.POLYGON] })).user;
|
|
610
636
|
return [4 /*yield*/, user.click(screen.getByLabelText('Draw area'))];
|
|
611
637
|
case 1:
|
|
612
638
|
_a.sent();
|
|
@@ -630,7 +656,7 @@ describe('ReltioMap tests', function () {
|
|
|
630
656
|
[1, 2],
|
|
631
657
|
[3, 4]
|
|
632
658
|
];
|
|
633
|
-
|
|
659
|
+
setUp(__assign(__assign({}, defaultProps), { onMapBoundsChanged: onMapBoundsChanged, drawingModes: [MAP_DRAWING_MODES.POLYGON], isSearchOnMapMove: true }));
|
|
634
660
|
jest.spyOn(helpers, 'getMapBoundsPolygon').mockImplementation(function () { return mapBoundsPolygon; });
|
|
635
661
|
expect(screen.getByLabelText('Search as I move the map').checked).toBe(true);
|
|
636
662
|
expect(onMapBoundsChanged).not.toHaveBeenCalled();
|
|
@@ -647,7 +673,7 @@ describe('ReltioMap tests', function () {
|
|
|
647
673
|
[1, 2],
|
|
648
674
|
[3, 4]
|
|
649
675
|
];
|
|
650
|
-
|
|
676
|
+
setUp(__assign(__assign({}, defaultProps), { onMapBoundsChanged: onMapBoundsChanged, drawingModes: [MAP_DRAWING_MODES.POLYGON], isSearchOnMapMove: true }));
|
|
651
677
|
jest.spyOn(helpers, 'getMapBoundsPolygon').mockImplementation(function () { return mapBoundsPolygon; });
|
|
652
678
|
expect(screen.getByLabelText('Search as I move the map').checked).toBe(true);
|
|
653
679
|
var mapMock = getLastInstance(Map);
|
|
@@ -665,7 +691,7 @@ describe('ReltioMap tests', function () {
|
|
|
665
691
|
it('should not call props.onMapBoundsChanged on google map idle if "Search when I move the map" mode is off', function () {
|
|
666
692
|
jest.useFakeTimers();
|
|
667
693
|
var onMapBoundsChanged = jest.fn();
|
|
668
|
-
|
|
694
|
+
setUp(__assign(__assign({}, defaultProps), { onMapBoundsChanged: onMapBoundsChanged, drawingModes: [MAP_DRAWING_MODES.POLYGON], isSearchOnMapMove: false }));
|
|
669
695
|
expect(screen.getByLabelText('Search as I move the map').checked).toBe(false);
|
|
670
696
|
getEventHandler(getLastInstance(Map), 'idle')();
|
|
671
697
|
jest.runOnlyPendingTimers();
|
package/Roles/Roles.test.js
CHANGED
|
@@ -1,15 +1,59 @@
|
|
|
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
|
+
};
|
|
1
12
|
import React from 'react';
|
|
2
|
-
import {
|
|
13
|
+
import { render, screen } from '@testing-library/react';
|
|
14
|
+
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
15
|
+
import { HistoryDiffContext } from '../contexts/HistoryAppearanceContext';
|
|
3
16
|
import { Roles } from './Roles';
|
|
4
|
-
|
|
5
|
-
|
|
17
|
+
var mdmValues = {
|
|
18
|
+
metadata: {
|
|
19
|
+
roles: [
|
|
20
|
+
{ uri: 'role1', label: 'Role label 1' },
|
|
21
|
+
{ uri: 'role2', label: 'Role label 2' }
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var defaultProps = {
|
|
26
|
+
values: ['role1', 'role2'],
|
|
27
|
+
className: 'class1'
|
|
28
|
+
};
|
|
29
|
+
var setUp = function (_a) {
|
|
30
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.CustomProviders, CustomProviders = _d === void 0 ? React.Fragment : _d;
|
|
31
|
+
var Providers = function (_a) {
|
|
32
|
+
var children = _a.children;
|
|
33
|
+
return (React.createElement(CustomProviders, null,
|
|
34
|
+
React.createElement(MdmModuleProvider, { values: mdmValues }, children)));
|
|
35
|
+
};
|
|
36
|
+
return render(React.createElement(Roles, __assign({}, props)), { wrapper: Providers });
|
|
37
|
+
};
|
|
6
38
|
describe('Roles tests', function () {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
expect(
|
|
12
|
-
|
|
13
|
-
|
|
39
|
+
it('should render correctly', function () {
|
|
40
|
+
setUp();
|
|
41
|
+
var attributeValue = screen.getByTestId('reltio-attribute-value');
|
|
42
|
+
expect(attributeValue).toHaveTextContent('Role label 1, Role label 2');
|
|
43
|
+
expect(attributeValue).toHaveClass('class1');
|
|
44
|
+
});
|
|
45
|
+
it('should provide history className', function () {
|
|
46
|
+
var historyDiff = {
|
|
47
|
+
appearance: { roles: { otherValue: 'DELETE_ATTRIBUTE', role1: 'INSERT_ATTRIBUTE' } },
|
|
48
|
+
attributes: {},
|
|
49
|
+
roles: [],
|
|
50
|
+
tags: []
|
|
51
|
+
};
|
|
52
|
+
var CustomProviders = function (_a) {
|
|
53
|
+
var children = _a.children;
|
|
54
|
+
return (React.createElement(HistoryDiffContext.Provider, { value: historyDiff }, children));
|
|
55
|
+
};
|
|
56
|
+
setUp({ CustomProviders: CustomProviders });
|
|
57
|
+
expect(screen.getByText('Role label 1')).toHaveClass('insertAttribute');
|
|
14
58
|
});
|
|
15
59
|
});
|