@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,72 +0,0 @@
|
|
|
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
|
-
import React from 'react';
|
|
13
|
-
import { shallow } from 'enzyme';
|
|
14
|
-
import { EntityAttrTypes } from '@reltio/mdm-sdk';
|
|
15
|
-
import { SpecialRenderer } from './SpecialRenderer';
|
|
16
|
-
import { ReadOnlyAttribute } from '../../../ReadOnlyAttributesFactory';
|
|
17
|
-
import { AttributeTitle } from '../../../AttributeTitle';
|
|
18
|
-
import { Tags } from '../../../Tags';
|
|
19
|
-
import { Roles } from '../../../Roles';
|
|
20
|
-
describe('SpecialRenderer tests', function () {
|
|
21
|
-
it('should render Roles component for roles', function () {
|
|
22
|
-
var props = {
|
|
23
|
-
attributeType: EntityAttrTypes.roles,
|
|
24
|
-
values: ['role1']
|
|
25
|
-
};
|
|
26
|
-
var component = shallow(React.createElement(SpecialRenderer, __assign({}, props)));
|
|
27
|
-
expect(component.find('.titleIcon').length).toBe(0);
|
|
28
|
-
var title = component.find(AttributeTitle);
|
|
29
|
-
expect(title.length).toBe(1);
|
|
30
|
-
expect(title.prop('label')).toBe(props.attributeType.label);
|
|
31
|
-
var roles = component.find(Roles);
|
|
32
|
-
expect(roles.length).toBe(1);
|
|
33
|
-
expect(roles.prop('values')).toBe(props.values);
|
|
34
|
-
expect(roles.prop('className')).toBe('attribute');
|
|
35
|
-
expect(component.find(ReadOnlyAttribute).length).toBe(0);
|
|
36
|
-
expect(component.find(Tags).length).toBe(0);
|
|
37
|
-
});
|
|
38
|
-
it('should render Tags component for tags and special icon before title', function () {
|
|
39
|
-
var props = {
|
|
40
|
-
attributeType: EntityAttrTypes.tags,
|
|
41
|
-
values: ['tag1']
|
|
42
|
-
};
|
|
43
|
-
var component = shallow(React.createElement(SpecialRenderer, __assign({}, props)));
|
|
44
|
-
expect(component.find('.titleIcon').length).toBe(1);
|
|
45
|
-
var title = component.find(AttributeTitle);
|
|
46
|
-
expect(title.length).toBe(1);
|
|
47
|
-
expect(title.prop('label')).toBe(props.attributeType.label);
|
|
48
|
-
var roles = component.find(Tags);
|
|
49
|
-
expect(roles.length).toBe(1);
|
|
50
|
-
expect(roles.prop('values')).toBe(props.values);
|
|
51
|
-
expect(roles.prop('className')).toBe('attribute');
|
|
52
|
-
expect(component.find(ReadOnlyAttribute).length).toBe(0);
|
|
53
|
-
expect(component.find(Roles).length).toBe(0);
|
|
54
|
-
});
|
|
55
|
-
it('should render Attribute component for activeness attributes', function () {
|
|
56
|
-
var props = {
|
|
57
|
-
attributeType: EntityAttrTypes.endDate,
|
|
58
|
-
values: [15455452345234]
|
|
59
|
-
};
|
|
60
|
-
var component = shallow(React.createElement(SpecialRenderer, __assign({}, props)));
|
|
61
|
-
expect(component.find('.titleIcon').length).toBe(0);
|
|
62
|
-
expect(component.find(AttributeTitle).length).toBe(1);
|
|
63
|
-
var attribute = component.find(ReadOnlyAttribute);
|
|
64
|
-
expect(attribute.length).toBe(1);
|
|
65
|
-
expect(attribute.prop('attributeValue')).toEqual({ value: props.values[0], uri: '' });
|
|
66
|
-
expect(attribute.prop('attributeType')).toBe(props.attributeType);
|
|
67
|
-
expect(attribute.prop('className')).toBe('attribute');
|
|
68
|
-
expect(attribute.prop('inlined')).toBe(true);
|
|
69
|
-
expect(component.find(Roles).length).toBe(0);
|
|
70
|
-
expect(component.find(Tags).length).toBe(0);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,337 +0,0 @@
|
|
|
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
|
-
};
|
|
48
|
-
import React from 'react';
|
|
49
|
-
import { screen, render } from '@testing-library/react';
|
|
50
|
-
import userEvent from '@testing-library/user-event';
|
|
51
|
-
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
52
|
-
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
53
|
-
import { Mode, ScreenType, ProfileViewType, typeAheadSearch } from '@reltio/mdm-sdk';
|
|
54
|
-
import { ScrollToElementContext, ScrollType } from '../contexts/ScrollToElementContext';
|
|
55
|
-
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
56
|
-
import { HiddenAttributesContext } from '../contexts/HiddenAttributesContext';
|
|
57
|
-
import RelationEditor from './RelationEditor';
|
|
58
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { typeAheadSearch: jest.fn() })); });
|
|
59
|
-
var mdmActions = {
|
|
60
|
-
setInitialInfo: jest.fn(),
|
|
61
|
-
setRelationType: jest.fn(),
|
|
62
|
-
closeRelationEditor: jest.fn(),
|
|
63
|
-
entityCreated: jest.fn(),
|
|
64
|
-
entityDeleted: jest.fn(),
|
|
65
|
-
setRelationEntity: jest.fn(),
|
|
66
|
-
errorDeactivated: jest.fn(),
|
|
67
|
-
errorsSet: jest.fn(),
|
|
68
|
-
addAttributes: jest.fn(),
|
|
69
|
-
modifyAttribute: jest.fn(),
|
|
70
|
-
removeAttribute: jest.fn(),
|
|
71
|
-
addRelation: jest.fn(),
|
|
72
|
-
editRelation: jest.fn()
|
|
73
|
-
};
|
|
74
|
-
var defaultRelation = {
|
|
75
|
-
relationUri: 'relations/uri$$Qgs4qfvmR3Daksyb1697627670006',
|
|
76
|
-
relationType: 'configuration/relationTypes/HasAddress',
|
|
77
|
-
relationLabel: 'has address',
|
|
78
|
-
object: {
|
|
79
|
-
type: 'configuration/relationTypes/HasAddress',
|
|
80
|
-
attributes: {},
|
|
81
|
-
uri: 'relations/uri$$Qgs4qfvmR3Daksyb1697627670006'
|
|
82
|
-
},
|
|
83
|
-
direction: 'out'
|
|
84
|
-
};
|
|
85
|
-
var defaultEntity = {
|
|
86
|
-
uri: 'entities/uri$$123',
|
|
87
|
-
type: 'configuration/entityTypes/HCP',
|
|
88
|
-
attributes: {}
|
|
89
|
-
};
|
|
90
|
-
var defaultMdmValues = {
|
|
91
|
-
initialConnection: { connection: { relation: defaultRelation, entity: {} } },
|
|
92
|
-
initialModifiedEntity: null,
|
|
93
|
-
modifiedEntity: null,
|
|
94
|
-
entity: defaultEntity,
|
|
95
|
-
dependentLookups: { editors: {}, structure: {}, initedTypeUris: [] },
|
|
96
|
-
uiConfigLayout: [],
|
|
97
|
-
uiConfigProfile: []
|
|
98
|
-
};
|
|
99
|
-
var defaultProps = {
|
|
100
|
-
connection: { relation: defaultRelation, entity: {} },
|
|
101
|
-
config: {
|
|
102
|
-
id: 'relationView',
|
|
103
|
-
component: ProfileViewType.Relations,
|
|
104
|
-
content: {
|
|
105
|
-
entityTypes: ['configuration/entityTypes/Location'],
|
|
106
|
-
outRelations: [{ uri: 'configuration/relationTypes/HasAddress', label: '{directionalLabel}' }]
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
metadata: {
|
|
110
|
-
entityTypes: [
|
|
111
|
-
{
|
|
112
|
-
uri: 'configuration/entityTypes/HCP',
|
|
113
|
-
label: 'HCP'
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
uri: 'configuration/entityTypes/Location',
|
|
117
|
-
label: 'Address'
|
|
118
|
-
}
|
|
119
|
-
],
|
|
120
|
-
relationTypes: [
|
|
121
|
-
{
|
|
122
|
-
uri: 'configuration/relationTypes/HasAddress',
|
|
123
|
-
label: 'has address',
|
|
124
|
-
startObject: {
|
|
125
|
-
objectTypeURI: 'configuration/entityTypes/HCP',
|
|
126
|
-
uri: 'configuration/relationTypes/HasAddress/startObject'
|
|
127
|
-
},
|
|
128
|
-
endObject: {
|
|
129
|
-
objectTypeURI: 'configuration/entityTypes/Location',
|
|
130
|
-
uri: 'configuration/relationTypes/HasAddress/endObject'
|
|
131
|
-
},
|
|
132
|
-
attributes: [
|
|
133
|
-
{
|
|
134
|
-
label: 'ActiveHiddenAttribute',
|
|
135
|
-
name: 'Active',
|
|
136
|
-
type: 'Boolean',
|
|
137
|
-
uri: 'configuration/relationTypes/HasAddress/attributes/Active'
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
},
|
|
143
|
-
mode: Mode.Editing
|
|
144
|
-
};
|
|
145
|
-
var setUp = function (_a) {
|
|
146
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d, _e = _b.contextError, contextError = _e === void 0 ? null : _e, _f = _b.hiddenAttributes, hiddenAttributes = _f === void 0 ? {} : _f;
|
|
147
|
-
var user = userEvent.setup();
|
|
148
|
-
var Providers = function (_a) {
|
|
149
|
-
var children = _a.children;
|
|
150
|
-
return (React.createElement(HiddenAttributesContext.Provider, { value: hiddenAttributes },
|
|
151
|
-
React.createElement(MdmModuleProvider, { actions: mdmActions, values: mdmValues },
|
|
152
|
-
React.createElement(ScrollToElementContext.Provider, { value: {
|
|
153
|
-
element: contextError,
|
|
154
|
-
highlightError: jest.fn(),
|
|
155
|
-
scrollIntoRef: jest.fn(),
|
|
156
|
-
type: ScrollType.Error
|
|
157
|
-
} },
|
|
158
|
-
React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment }, children)))));
|
|
159
|
-
};
|
|
160
|
-
return __assign(__assign({}, render(React.createElement(RelationEditor, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
161
|
-
};
|
|
162
|
-
describe('RelationEditor behaviour', function () {
|
|
163
|
-
beforeEach(function () {
|
|
164
|
-
typeAheadSearch.mockResolvedValue([]);
|
|
165
|
-
});
|
|
166
|
-
afterEach(function () {
|
|
167
|
-
jest.clearAllMocks();
|
|
168
|
-
});
|
|
169
|
-
it('should show "create entity" button if mode is not suggesting', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
170
|
-
var user, inputs;
|
|
171
|
-
return __generator(this, function (_a) {
|
|
172
|
-
switch (_a.label) {
|
|
173
|
-
case 0:
|
|
174
|
-
user = setUp().user;
|
|
175
|
-
inputs = screen.getAllByRole('combobox');
|
|
176
|
-
return [4 /*yield*/, user.click(inputs[0])];
|
|
177
|
-
case 1:
|
|
178
|
-
_a.sent();
|
|
179
|
-
expect(typeAheadSearch).toHaveBeenCalledWith([{ label: 'Address', uri: 'configuration/entityTypes/Location' }], '', {
|
|
180
|
-
globalFilter: '',
|
|
181
|
-
max: 20,
|
|
182
|
-
searchOptions: '',
|
|
183
|
-
sendMasked: false
|
|
184
|
-
});
|
|
185
|
-
screen.getByText('Create new Address');
|
|
186
|
-
return [2 /*return*/];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}); });
|
|
190
|
-
it('should show "create entity" button if mode is suggesting, but main entity uri is not temporary', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
191
|
-
var props, mdmValues, user, inputs;
|
|
192
|
-
return __generator(this, function (_a) {
|
|
193
|
-
switch (_a.label) {
|
|
194
|
-
case 0:
|
|
195
|
-
props = __assign(__assign({}, defaultProps), { mode: Mode.Suggesting });
|
|
196
|
-
mdmValues = __assign(__assign({}, defaultMdmValues), { entity: __assign(__assign({}, defaultEntity), { uri: 'entities/123' }) });
|
|
197
|
-
user = setUp({ props: props, mdmValues: mdmValues }).user;
|
|
198
|
-
inputs = screen.getAllByRole('combobox');
|
|
199
|
-
return [4 /*yield*/, user.click(inputs[0])];
|
|
200
|
-
case 1:
|
|
201
|
-
_a.sent();
|
|
202
|
-
screen.getByText('Create new Address');
|
|
203
|
-
return [2 /*return*/];
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}); });
|
|
207
|
-
it('should show "create entity" button if mode is suggesting, main entity uri is temporary, but authoring mode is enabled for current entity type', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
-
var uiConfigProfile, props, mdmValues, user, inputs;
|
|
209
|
-
return __generator(this, function (_a) {
|
|
210
|
-
switch (_a.label) {
|
|
211
|
-
case 0:
|
|
212
|
-
uiConfigProfile = [
|
|
213
|
-
{
|
|
214
|
-
label: 'Profile',
|
|
215
|
-
id: 'com.reltio.plugins.ProfileEntityAction',
|
|
216
|
-
class: ScreenType.Profile,
|
|
217
|
-
entityTypes: {
|
|
218
|
-
'configuration/entityTypes/HCP': {
|
|
219
|
-
views: [],
|
|
220
|
-
layout: [],
|
|
221
|
-
sidePanelViews: [],
|
|
222
|
-
authoring: [
|
|
223
|
-
{
|
|
224
|
-
label: 'Profile details',
|
|
225
|
-
views: [],
|
|
226
|
-
layout: []
|
|
227
|
-
}
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
];
|
|
233
|
-
props = __assign(__assign({}, defaultProps), { mode: Mode.Suggesting });
|
|
234
|
-
mdmValues = __assign(__assign({}, defaultMdmValues), { uiConfigProfile: uiConfigProfile });
|
|
235
|
-
user = setUp({ props: props, mdmValues: mdmValues }).user;
|
|
236
|
-
inputs = screen.getAllByRole('combobox');
|
|
237
|
-
return [4 /*yield*/, user.click(inputs[0])];
|
|
238
|
-
case 1:
|
|
239
|
-
_a.sent();
|
|
240
|
-
screen.getByText('Create new Address');
|
|
241
|
-
return [2 /*return*/];
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}); });
|
|
245
|
-
it('should not show "create entity" button if mode is "Suggesting", main entity uri is temporary and authoring mode is not enabled for current entity type', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
246
|
-
var props, user, inputs;
|
|
247
|
-
return __generator(this, function (_a) {
|
|
248
|
-
switch (_a.label) {
|
|
249
|
-
case 0:
|
|
250
|
-
props = __assign(__assign({}, defaultProps), { mode: Mode.Suggesting });
|
|
251
|
-
user = setUp({ props: props }).user;
|
|
252
|
-
inputs = screen.getAllByRole('combobox');
|
|
253
|
-
return [4 /*yield*/, user.click(inputs[0])];
|
|
254
|
-
case 1:
|
|
255
|
-
_a.sent();
|
|
256
|
-
expect(screen.queryByText('Create new Address')).not.toBeInTheDocument();
|
|
257
|
-
return [2 /*return*/];
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}); });
|
|
261
|
-
it('should not hide hidden attributes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
262
|
-
var hiddenAttributes, user, inputs;
|
|
263
|
-
return __generator(this, function (_a) {
|
|
264
|
-
switch (_a.label) {
|
|
265
|
-
case 0:
|
|
266
|
-
hiddenAttributes = {
|
|
267
|
-
'entities/uri$$123': ['configuration/relationTypes/HasAddress/attributes/Active']
|
|
268
|
-
};
|
|
269
|
-
user = setUp({ hiddenAttributes: hiddenAttributes }).user;
|
|
270
|
-
inputs = screen.getAllByRole('combobox');
|
|
271
|
-
return [4 /*yield*/, user.click(inputs[0])];
|
|
272
|
-
case 1:
|
|
273
|
-
_a.sent();
|
|
274
|
-
expect(screen.getByText('ActiveHiddenAttribute')).toBeInTheDocument();
|
|
275
|
-
return [2 /*return*/];
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
}); });
|
|
279
|
-
it('should add sendMasked option if connection entity has attribute with masked value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
280
|
-
var props, user, inputs;
|
|
281
|
-
return __generator(this, function (_a) {
|
|
282
|
-
switch (_a.label) {
|
|
283
|
-
case 0:
|
|
284
|
-
props = __assign(__assign({}, defaultProps), { connection: {
|
|
285
|
-
relation: defaultRelation,
|
|
286
|
-
entity: {
|
|
287
|
-
uri: 'entities/uri$$123',
|
|
288
|
-
type: 'configuration/entityTypes/HCP',
|
|
289
|
-
object: {
|
|
290
|
-
uri: 'entities/04B1CqH',
|
|
291
|
-
type: 'configuration/entityTypes/Location',
|
|
292
|
-
attributes: {
|
|
293
|
-
Address: [
|
|
294
|
-
{
|
|
295
|
-
label: 'AcOEvPaVqTfzZCE Josogaf VA',
|
|
296
|
-
relationshipLabel: '',
|
|
297
|
-
value: {
|
|
298
|
-
AddressLine1: [
|
|
299
|
-
{
|
|
300
|
-
type: 'configuration/entityTypes/Location/attributes/AddressLine1',
|
|
301
|
-
ov: true,
|
|
302
|
-
value: 'AcOEvPaVqTfzZCE',
|
|
303
|
-
uri: 'entities/04B1CqH/attributes/Address/03R51aT/AddressLine1/1XFBcmPYm'
|
|
304
|
-
}
|
|
305
|
-
],
|
|
306
|
-
AddressLine2: [
|
|
307
|
-
{
|
|
308
|
-
type: 'configuration/entityTypes/Location/attributes/AddressLine2',
|
|
309
|
-
ov: true,
|
|
310
|
-
masked: true,
|
|
311
|
-
value: 'KBmiSMlqhElLHMH',
|
|
312
|
-
uri: 'entities/04B1CqH/attributes/Address/03R51aT/AddressLine2/1XFBcmTp2'
|
|
313
|
-
}
|
|
314
|
-
]
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
]
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
} });
|
|
322
|
-
user = setUp({ props: props }).user;
|
|
323
|
-
inputs = screen.getAllByRole('textbox');
|
|
324
|
-
return [4 /*yield*/, user.click(inputs[0])];
|
|
325
|
-
case 1:
|
|
326
|
-
_a.sent();
|
|
327
|
-
expect(typeAheadSearch).toHaveBeenCalledWith([{ label: 'Address', uri: 'configuration/entityTypes/Location' }], '', {
|
|
328
|
-
globalFilter: '',
|
|
329
|
-
max: 20,
|
|
330
|
-
searchOptions: '',
|
|
331
|
-
sendMasked: true
|
|
332
|
-
});
|
|
333
|
-
return [2 /*return*/];
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}); });
|
|
337
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MapInstance } from '../../types';
|
|
3
|
-
type Props = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
className?: string;
|
|
6
|
-
position: number;
|
|
7
|
-
map: MapInstance;
|
|
8
|
-
};
|
|
9
|
-
export declare const MapControlContainer: ({ children, className, position, map }: Props) => React.ReactPortal;
|
|
10
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
|
-
export var MapControlContainer = function (_a) {
|
|
4
|
-
var children = _a.children, className = _a.className, position = _a.position, map = _a.map;
|
|
5
|
-
var _b = useState(null), controlElement = _b[0], setControlElement = _b[1];
|
|
6
|
-
useEffect(function () {
|
|
7
|
-
var controlDiv = document.createElement('div');
|
|
8
|
-
var divIndex = map.controls[position].length;
|
|
9
|
-
map.controls[position].push(controlDiv);
|
|
10
|
-
setControlElement(controlDiv);
|
|
11
|
-
return function () {
|
|
12
|
-
map.controls[position].removeAt(divIndex);
|
|
13
|
-
};
|
|
14
|
-
}, [map, position]);
|
|
15
|
-
useEffect(function () {
|
|
16
|
-
if (controlElement && className) {
|
|
17
|
-
controlElement.classList.add(className);
|
|
18
|
-
}
|
|
19
|
-
}, [className, controlElement]);
|
|
20
|
-
if (controlElement) {
|
|
21
|
-
return createPortal(children, controlElement);
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { mount } from 'enzyme';
|
|
3
|
-
import { MapControlContainer } from './MapControlContainer';
|
|
4
|
-
describe('MapControlContainer tests', function () {
|
|
5
|
-
it('should create div and assign it to the map', function () {
|
|
6
|
-
var map = { controls: { 1: [] } };
|
|
7
|
-
mount(React.createElement(MapControlContainer, { position: 1, map: map },
|
|
8
|
-
React.createElement("div", null, "test")));
|
|
9
|
-
var containerElement = map.controls[1][0];
|
|
10
|
-
expect(containerElement.innerHTML.indexOf('<div>test</div>')).not.toBe(-1);
|
|
11
|
-
});
|
|
12
|
-
it('should remove div from map on unmount', function () {
|
|
13
|
-
var arrayStructure = {
|
|
14
|
-
container: [],
|
|
15
|
-
get length() {
|
|
16
|
-
return this.container.length;
|
|
17
|
-
},
|
|
18
|
-
push: function (item) {
|
|
19
|
-
return this.container.push(item);
|
|
20
|
-
},
|
|
21
|
-
removeAt: function (index) {
|
|
22
|
-
return this.container.splice(index);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
var map = { controls: { 1: arrayStructure } };
|
|
26
|
-
var component = mount(React.createElement(MapControlContainer, { position: 1, map: map },
|
|
27
|
-
React.createElement("div", null, "test")));
|
|
28
|
-
var getDivContainer = function (map) { return map.controls[1]; };
|
|
29
|
-
expect(getDivContainer(map).length).toBe(1);
|
|
30
|
-
component.unmount();
|
|
31
|
-
expect(getDivContainer(map).length).toBe(0);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MapControlContainer } from './MapControlContainer';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MapControlContainer } from './MapControlContainer';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow, ReactWrapper } from 'enzyme';
|
|
3
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
4
|
-
import Checkbox from '@mui/material/Checkbox';
|
|
5
|
-
import { TopCenterMapControls } from './TopCenterMapControls';
|
|
6
|
-
var findCheckbox = function (component) {
|
|
7
|
-
var control = new ReactWrapper(component.find(FormControlLabel).prop('control'));
|
|
8
|
-
return control.find(Checkbox);
|
|
9
|
-
};
|
|
10
|
-
describe('TopCenterMapControls tests', function () {
|
|
11
|
-
it('should render main parts', function () {
|
|
12
|
-
var component = shallow(React.createElement(TopCenterMapControls, { isSearchOnMapMove: false }));
|
|
13
|
-
expect(component.find(FormControlLabel).length).toBe(1);
|
|
14
|
-
var checkbox = findCheckbox(component);
|
|
15
|
-
expect(checkbox.length).toBe(1);
|
|
16
|
-
expect(checkbox.prop('checked')).toBe(false);
|
|
17
|
-
});
|
|
18
|
-
it('should render checked checkbox if "isSearchOnMapMove" prop is true', function () {
|
|
19
|
-
var component = shallow(React.createElement(TopCenterMapControls, { isSearchOnMapMove: true }));
|
|
20
|
-
expect(component.find(FormControlLabel).length).toBe(1);
|
|
21
|
-
var checkbox = findCheckbox(component);
|
|
22
|
-
expect(checkbox.length).toBe(1);
|
|
23
|
-
expect(checkbox.prop('checked')).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it('should call "onChangeIsSearchOnMapMove" on Checkbox change', function () {
|
|
26
|
-
var onChange = jest.fn();
|
|
27
|
-
var component = shallow(React.createElement(TopCenterMapControls, { onChangeIsSearchOnMapMove: onChange }));
|
|
28
|
-
var checkbox = findCheckbox(component);
|
|
29
|
-
checkbox.prop('onChange')({
|
|
30
|
-
target: {
|
|
31
|
-
checked: true
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
expect(onChange).toHaveBeenCalledWith(true);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
import React from 'react';
|
|
13
|
-
import { shallow } from 'enzyme';
|
|
14
|
-
import { ButtonWithTooltip, TopRightMapControls } from './TopRightMapControls';
|
|
15
|
-
import { MAP_DRAWING_MODES } from '../../../constants';
|
|
16
|
-
import DrawIcon from '../../../icons/Draw';
|
|
17
|
-
import RadiusIcon from '../../../icons/Radius';
|
|
18
|
-
describe('TopRightMapControls tests', function () {
|
|
19
|
-
var defaultProps;
|
|
20
|
-
beforeEach(function () {
|
|
21
|
-
defaultProps = {
|
|
22
|
-
onDrawingModeChanged: jest.fn(),
|
|
23
|
-
onClearOverlay: jest.fn()
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
it('should render nothing by default', function () {
|
|
27
|
-
var component = shallow(React.createElement(TopRightMapControls, __assign({}, defaultProps)));
|
|
28
|
-
expect(component.find(ButtonWithTooltip).length).toBe(0);
|
|
29
|
-
});
|
|
30
|
-
it('should render clear button if "drawingMode" is defined', function () {
|
|
31
|
-
var component = shallow(React.createElement(TopRightMapControls, __assign({}, defaultProps, { drawingMode: MAP_DRAWING_MODES.POLYGON, drawingModes: [MAP_DRAWING_MODES.POLYGON] })));
|
|
32
|
-
var button = component.find(ButtonWithTooltip);
|
|
33
|
-
expect(button.length).toBe(1);
|
|
34
|
-
expect(button.prop('tooltipTitle')).toBe('Clear area');
|
|
35
|
-
button.prop('onClick')();
|
|
36
|
-
expect(defaultProps.onDrawingModeChanged).toHaveBeenCalledWith(null);
|
|
37
|
-
});
|
|
38
|
-
it('should render clear button if "hasActiveOverlay" is defined', function () {
|
|
39
|
-
var component = shallow(React.createElement(TopRightMapControls, __assign({}, defaultProps, { hasActiveOverlay: true, drawingModes: [MAP_DRAWING_MODES.POLYGON] })));
|
|
40
|
-
var button = component.find(ButtonWithTooltip);
|
|
41
|
-
expect(button.length).toBe(1);
|
|
42
|
-
expect(button.prop('tooltipTitle')).toBe('Clear area');
|
|
43
|
-
button.prop('onClick')();
|
|
44
|
-
expect(defaultProps.onClearOverlay).toHaveBeenCalled();
|
|
45
|
-
});
|
|
46
|
-
it('should render button for every drawing mode', function () {
|
|
47
|
-
var component = shallow(React.createElement(TopRightMapControls, __assign({}, defaultProps, { drawingModes: [MAP_DRAWING_MODES.POLYGON, MAP_DRAWING_MODES.CIRCLE] })));
|
|
48
|
-
expect(component.find(ButtonWithTooltip).length).toBe(2);
|
|
49
|
-
var button1 = component.find(ButtonWithTooltip).at(0);
|
|
50
|
-
var button2 = component.find(ButtonWithTooltip).at(1);
|
|
51
|
-
expect(button1.prop('tooltipTitle')).toBe('Draw area');
|
|
52
|
-
expect(button1.find(DrawIcon).length).toBe(1);
|
|
53
|
-
button1.prop('onClick')();
|
|
54
|
-
expect(defaultProps.onDrawingModeChanged).toHaveBeenCalledWith(MAP_DRAWING_MODES.POLYGON);
|
|
55
|
-
expect(button2.prop('tooltipTitle')).toBe('Draw area');
|
|
56
|
-
expect(button2.find(RadiusIcon).length).toBe(1);
|
|
57
|
-
button2.prop('onClick')();
|
|
58
|
-
expect(defaultProps.onDrawingModeChanged).toHaveBeenCalledWith(MAP_DRAWING_MODES.CIRCLE);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
import React from 'react';
|
|
13
|
-
import { screen, render } from '@testing-library/react';
|
|
14
|
-
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
15
|
-
import { HistoryDiffContext } from '../../../contexts/HistoryAppearanceContext';
|
|
16
|
-
import { Role } from '../Role';
|
|
17
|
-
var metadata = { roles: [{ uri: 'role1', label: 'Role Label' }] };
|
|
18
|
-
var setUp = function (props, CustomProviders) {
|
|
19
|
-
if (CustomProviders === void 0) { CustomProviders = React.Fragment; }
|
|
20
|
-
var Providers = function (_a) {
|
|
21
|
-
var children = _a.children;
|
|
22
|
-
return (React.createElement(CustomProviders, null,
|
|
23
|
-
React.createElement(MdmModuleProvider, { values: { metadata: metadata } }, children)));
|
|
24
|
-
};
|
|
25
|
-
return render(React.createElement(Role, __assign({}, props)), { wrapper: Providers });
|
|
26
|
-
};
|
|
27
|
-
describe('Role tests', function () {
|
|
28
|
-
var value = 'role1';
|
|
29
|
-
it('should render role label', function () {
|
|
30
|
-
setUp({ value: value });
|
|
31
|
-
screen.getByText('Role Label');
|
|
32
|
-
});
|
|
33
|
-
it('should provide history className', function () {
|
|
34
|
-
var _a;
|
|
35
|
-
var historyDiff = {
|
|
36
|
-
appearance: {
|
|
37
|
-
roles: (_a = {
|
|
38
|
-
otherValue: 'DELETE_ATTRIBUTE'
|
|
39
|
-
},
|
|
40
|
-
_a[value] = 'INSERT_ATTRIBUTE',
|
|
41
|
-
_a)
|
|
42
|
-
},
|
|
43
|
-
attributes: {},
|
|
44
|
-
roles: [],
|
|
45
|
-
tags: []
|
|
46
|
-
};
|
|
47
|
-
var Providers = function (_a) {
|
|
48
|
-
var children = _a.children;
|
|
49
|
-
return (React.createElement(HistoryDiffContext.Provider, { value: historyDiff }, children));
|
|
50
|
-
};
|
|
51
|
-
setUp({ value: value }, Providers);
|
|
52
|
-
var label = screen.getByText('Role Label');
|
|
53
|
-
expect(label).toHaveClass('insertAttribute');
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|