@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,35 +1,100 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import React from 'react';
|
|
2
|
-
import { shallow } from 'enzyme';
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
49
|
import i18n from 'ui-i18n';
|
|
5
|
-
import {
|
|
50
|
+
import { render, screen } from '@testing-library/react';
|
|
51
|
+
import userEvent from '@testing-library/user-event';
|
|
6
52
|
import { PotentialMatchReviewCard } from './PotentialMatchReviewCard';
|
|
53
|
+
var defaultProps = {
|
|
54
|
+
date: 1612265837382,
|
|
55
|
+
createdBy: 'testUser',
|
|
56
|
+
type: 'pmReviewCardType',
|
|
57
|
+
step: 'Review',
|
|
58
|
+
children: React.createElement("div", null, "Children"),
|
|
59
|
+
Actions: React.createElement("div", null, "Actions")
|
|
60
|
+
};
|
|
61
|
+
var setUp = function (props) {
|
|
62
|
+
if (props === void 0) { props = defaultProps; }
|
|
63
|
+
var user = userEvent.setup();
|
|
64
|
+
return __assign(__assign({}, render(React.createElement(PotentialMatchReviewCard, __assign({}, props)))), { user: user });
|
|
65
|
+
};
|
|
7
66
|
describe('Potential match review card tests', function () {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
expect(component.find('.info').at(1).text()).toBe('Created by testUser');
|
|
21
|
-
expect(component.find('.info').at(2).text()).toBe('Step: Review');
|
|
22
|
-
expect(component.find('.actions').text()).toBe('Actions');
|
|
23
|
-
expect(component.find('.children').length).toBe(0);
|
|
24
|
-
});
|
|
25
|
-
it('should show children in expanded mode', function () {
|
|
26
|
-
jest.spyOn(i18n, 'date').mockImplementation(identity);
|
|
27
|
-
var component = shallow(React.createElement(PotentialMatchReviewCard, { date: date, createdBy: createdBy, type: type, step: step, Actions: Actions }, children));
|
|
28
|
-
expect(component.find('CollapseButton').prop('isOpen')).toBeFalsy();
|
|
29
|
-
act(function () {
|
|
30
|
-
component.find('CollapseButton').simulate('click');
|
|
31
|
-
component.update();
|
|
67
|
+
it('should render correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
setUp();
|
|
70
|
+
screen.getByTestId('SvgPmIcon');
|
|
71
|
+
screen.getByText('Match review');
|
|
72
|
+
screen.getByText(i18n.date(defaultProps.date, 'L'));
|
|
73
|
+
screen.getByText('pmReviewCardType');
|
|
74
|
+
screen.getByText('Created by testUser');
|
|
75
|
+
screen.getByText('Step: Review');
|
|
76
|
+
screen.getByText('Actions');
|
|
77
|
+
expect(screen.queryByText('Children')).not.toBeInTheDocument();
|
|
78
|
+
return [2 /*return*/];
|
|
32
79
|
});
|
|
33
|
-
|
|
34
|
-
|
|
80
|
+
}); });
|
|
81
|
+
it('should expand and collapse content correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
+
var user;
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
switch (_a.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
user = setUp().user;
|
|
87
|
+
expect(screen.queryByText('Children')).not.toBeInTheDocument();
|
|
88
|
+
return [4 /*yield*/, user.click(screen.getByTestId('collapse-button'))];
|
|
89
|
+
case 1:
|
|
90
|
+
_a.sent();
|
|
91
|
+
screen.getByText('Children');
|
|
92
|
+
return [4 /*yield*/, user.click(screen.getByTestId('collapse-button'))];
|
|
93
|
+
case 2:
|
|
94
|
+
_a.sent();
|
|
95
|
+
expect(screen.queryByText('Children')).not.toBeInTheDocument();
|
|
96
|
+
return [2 /*return*/];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}); });
|
|
35
100
|
});
|
|
@@ -10,78 +10,85 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { render, screen } from '@testing-library/react';
|
|
14
|
+
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
14
15
|
import { ProfileBand } from './ProfileBand';
|
|
15
|
-
import { EntityAvatar } from '../EntityAvatar';
|
|
16
|
-
import { EntityTypeBadge } from '../EntityTypeBadge';
|
|
17
|
-
import { useMdmMetadata, useMdmShowEntityId } from '../contexts/MdmModuleContext';
|
|
18
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign({}, jest.requireActual('@reltio/mdm-sdk'))); });
|
|
19
|
-
jest.mock('../contexts/MdmModuleContext', function () { return (__assign(__assign({}, jest.requireActual('../contexts/MdmModuleContext')), { useMdmMetadata: jest.fn(), useMdmShowEntityId: jest.fn() })); });
|
|
20
16
|
var metadata = {
|
|
21
17
|
entityTypes: [
|
|
22
18
|
{
|
|
23
19
|
uri: 'configuration/entityTypes/HCP',
|
|
24
20
|
attributes: [
|
|
25
21
|
{
|
|
22
|
+
type: 'String',
|
|
26
23
|
name: 'FirstName',
|
|
27
24
|
uri: 'configuration/entityTypes/HCP/attributes/FirstName'
|
|
28
25
|
}
|
|
29
26
|
],
|
|
30
|
-
businessCardAttributeURIs: ['configuration/entityTypes/HCP/attributes/FirstName']
|
|
27
|
+
businessCardAttributeURIs: ['configuration/entityTypes/HCP/attributes/FirstName'],
|
|
28
|
+
typeImage: 'images/defaultImage/image.png'
|
|
31
29
|
}
|
|
32
30
|
]
|
|
33
31
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
var defaultEntity = {
|
|
33
|
+
attributes: {
|
|
34
|
+
FirstName: [
|
|
35
|
+
{
|
|
36
|
+
ov: true,
|
|
37
|
+
value: 'First name',
|
|
38
|
+
uri: 'entities/1MheIGmc/attributes/FirstName/2l2ktkUn0',
|
|
39
|
+
type: 'configuration/entityTypes/HCP/attributes/FirstName'
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
label: 'Entity one',
|
|
44
|
+
secondaryLabel: 'Entity expanded label',
|
|
45
|
+
type: 'configuration/entityTypes/HCP',
|
|
46
|
+
uri: 'entities/uioU78'
|
|
47
|
+
};
|
|
48
|
+
var defaultProps = { entity: defaultEntity, children: React.createElement("div", null, "Content") };
|
|
49
|
+
var defaultMdmValues = {
|
|
50
|
+
showEntityId: true,
|
|
51
|
+
absoluteImagePath: 'https://reltio.com/nui/imagePath',
|
|
52
|
+
metadata: metadata
|
|
53
|
+
};
|
|
54
|
+
var setUp = function (_a) {
|
|
55
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
56
|
+
var Providers = function (_a) {
|
|
57
|
+
var children = _a.children;
|
|
58
|
+
return (React.createElement(MdmModuleProvider, { values: mdmValues }, children));
|
|
54
59
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
expect(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
return render(React.createElement(ProfileBand, __assign({}, props)), { wrapper: Providers });
|
|
61
|
+
};
|
|
62
|
+
describe('Profile band tests', function () {
|
|
63
|
+
it('should render main parts correctly', function () {
|
|
64
|
+
setUp();
|
|
65
|
+
expect(screen.getByRole('img')).toHaveAttribute('src', 'https://reltio.com/nui/imagePath/images/defaultImage/image.png');
|
|
66
|
+
screen.getByText('Entity one');
|
|
67
|
+
screen.getByText('Entity expanded label');
|
|
68
|
+
screen.getByText('First name');
|
|
69
|
+
screen.getByText('Entity ID: uioU78');
|
|
70
|
+
screen.getByText('Content');
|
|
65
71
|
});
|
|
66
|
-
it('should render inactive profile band', function () {
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
|
|
72
|
+
it('should render inactive profile band correctly', function () {
|
|
73
|
+
var entity = __assign(__assign({}, defaultEntity), { endDate: Date.now() - 10 });
|
|
74
|
+
var props = __assign(__assign({}, defaultProps), { entity: entity });
|
|
75
|
+
setUp({ props: props });
|
|
76
|
+
expect(screen.getByTestId('reltio-profile-band').firstChild).toHaveClass('inactive');
|
|
70
77
|
});
|
|
71
|
-
it('should hide
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
expect(
|
|
78
|
+
it('should hide entity id for create mode', function () {
|
|
79
|
+
var entity = __assign(__assign({}, defaultEntity), { uri: 'entities/uri$$1646115317921' });
|
|
80
|
+
var props = __assign(__assign({}, defaultProps), { entity: entity });
|
|
81
|
+
setUp({ props: props });
|
|
82
|
+
expect(screen.queryByLabelText('Copy to clipboard')).not.toBeInTheDocument();
|
|
76
83
|
});
|
|
77
|
-
it('should hide entityId if "showEntityId"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
expect(component.find('.entityId').length).toBe(0);
|
|
84
|
+
it('should hide entityId if "showEntityId" is false', function () {
|
|
85
|
+
var mdmValues = __assign(__assign({}, defaultMdmValues), { showEntityId: false });
|
|
86
|
+
setUp({ mdmValues: mdmValues });
|
|
87
|
+
expect(screen.queryByLabelText('Copy to clipboard')).not.toBeInTheDocument();
|
|
82
88
|
});
|
|
83
89
|
it('should render custom label correctly using renderLabel prop', function () {
|
|
84
|
-
var
|
|
85
|
-
|
|
90
|
+
var props = __assign(__assign({}, defaultProps), { renderLabel: function (label) { return "custom ".concat(label); } });
|
|
91
|
+
setUp({ props: props });
|
|
92
|
+
screen.getByText('custom Entity one');
|
|
86
93
|
});
|
|
87
94
|
});
|
|
@@ -1,33 +1,115 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
1
48
|
import React from 'react';
|
|
2
|
-
import {
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
3
51
|
import ProfileCard from './ProfileCard';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
52
|
+
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
53
|
+
var defaultEntity = {
|
|
54
|
+
uri: 'entities/123',
|
|
55
|
+
label: 'Main label',
|
|
56
|
+
secondaryLabel: 'secondary label',
|
|
57
|
+
type: 'configuration/entityTypes/HCP'
|
|
58
|
+
};
|
|
59
|
+
var defaultProps = { entity: defaultEntity };
|
|
60
|
+
var mdmValues = {
|
|
61
|
+
metadata: {
|
|
62
|
+
entityTypes: [
|
|
63
|
+
{
|
|
64
|
+
uri: 'configuration/entityTypes/HCP',
|
|
65
|
+
label: 'HCP',
|
|
66
|
+
typeImage: 'images/defaultImage/typeImage_gender_neutral.png'
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
uiPath: 'https://reltio.com/nui',
|
|
71
|
+
absoluteImagePath: 'https://images.reltio.com'
|
|
72
|
+
};
|
|
73
|
+
var setUp = function (props) {
|
|
74
|
+
if (props === void 0) { props = defaultProps; }
|
|
75
|
+
var user = userEvent.setup();
|
|
76
|
+
var Providers = function (_a) {
|
|
77
|
+
var children = _a.children;
|
|
78
|
+
return (React.createElement(MdmModuleProvider, { values: mdmValues }, children));
|
|
12
79
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
80
|
+
return __assign(__assign({}, render(React.createElement(ProfileCard, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
81
|
+
};
|
|
82
|
+
describe('Profile card tests', function () {
|
|
83
|
+
it('should render profile card content correctly if variant is "normal"', function () {
|
|
84
|
+
setUp();
|
|
85
|
+
expect(screen.getByRole('img')).toHaveAttribute('src', 'https://images.reltio.com/images/defaultImage/typeImage_gender_neutral.png');
|
|
86
|
+
expect(screen.getByRole('link', { name: 'Main label' })).toHaveAttribute('href', 'https://reltio.com/nui#p~com.reltio.plugins.entity.default.DefaultPerspective_e~entities/123');
|
|
87
|
+
screen.getByText('secondary label');
|
|
88
|
+
screen.getByText('HCP');
|
|
89
|
+
screen.getByText('ID:');
|
|
90
|
+
screen.getByText('123');
|
|
20
91
|
});
|
|
21
|
-
it('should
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
92
|
+
it('should copy entity ID on click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
+
var user, clipboardText;
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
user = setUp().user;
|
|
98
|
+
return [4 /*yield*/, user.click(screen.getByText('123'))];
|
|
99
|
+
case 1:
|
|
100
|
+
_a.sent();
|
|
101
|
+
return [4 /*yield*/, navigator.clipboard.readText()];
|
|
102
|
+
case 2:
|
|
103
|
+
clipboardText = _a.sent();
|
|
104
|
+
expect(clipboardText).toBe('123');
|
|
105
|
+
return [2 /*return*/];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}); });
|
|
109
|
+
it('should render profile card placeholder correctly if variant is "loading"', function () {
|
|
110
|
+
var props = __assign(__assign({}, defaultProps), { variant: 'loading' });
|
|
111
|
+
setUp(props);
|
|
112
|
+
screen.getByTestId('profile-card-placeholder-avatar');
|
|
113
|
+
screen.getByTestId('profile-card-placeholder-info');
|
|
32
114
|
});
|
|
33
115
|
});
|
|
@@ -6,9 +6,7 @@ type Props = {
|
|
|
6
6
|
selectedEntityUri?: string;
|
|
7
7
|
onEntityClick?: (entityUri: string) => void;
|
|
8
8
|
onEntityHover?: (entityUri: string) => void;
|
|
9
|
-
entitiesImportStatus?:
|
|
10
|
-
entityUri: string;
|
|
11
|
-
};
|
|
9
|
+
entitiesImportStatus?: Record<string, string>;
|
|
12
10
|
entityButtonsRenderer?: (entity: Entity) => void;
|
|
13
11
|
};
|
|
14
12
|
export declare const ProfilesList: ({ entities, entityToHighlight, selectedEntityUri, onEntityClick, onEntityHover, entitiesImportStatus, entityButtonsRenderer }: Props) => React.JSX.Element;
|
|
@@ -53,7 +53,7 @@ export var ProfilesList = function (_a) {
|
|
|
53
53
|
_a[styles.highlighted] = entityUri === entityToHighlight,
|
|
54
54
|
_a[styles.inactive] = !isActive,
|
|
55
55
|
_a[styles.justImported] = importStatus === ImportModes.Success,
|
|
56
|
-
_a)), onClick: onEntityClick ? function () { return onEntityClick(entityUri); } : undefined, onMouseEnter: onEntityHover ? function () { return onEntityHover(entityUri); } : undefined, onMouseLeave: onEntityHover ? function () { return onEntityHover(null); } : undefined, "data-entity-uri": entityUri },
|
|
56
|
+
_a)), onClick: onEntityClick ? function () { return onEntityClick(entityUri); } : undefined, onMouseEnter: onEntityHover ? function () { return onEntityHover(entityUri); } : undefined, onMouseLeave: onEntityHover ? function () { return onEntityHover(null); } : undefined, "data-reltio-id": "profiles-list-item", "data-entity-uri": entityUri },
|
|
57
57
|
React.createElement(EntityAvatar, { entity: entity, avatarClassName: styles.avatar, imageClassName: styles.image }),
|
|
58
58
|
React.createElement("div", { className: styles.info },
|
|
59
59
|
React.createElement("div", null,
|