@reltio/components 1.4.2051 → 1.4.2052
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/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/ChartTooltip/ChartTooltip.js +3 -3
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/DropDownMenuButton/DropDownMenuButton.js +1 -1
- package/HOCs/withAsyncMount/withAsyncMount.test.js +52 -52
- package/IgnoreButton/IgnoreButton.spec.js +109 -20
- package/Image/Image.d.ts +1 -1
- package/Image/Image.js +8 -8
- package/Image/Image.test.js +46 -51
- package/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
- package/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
- package/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
- package/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
- package/ImageAttributesLine/ImageAttributesLine.js +1 -1
- package/ImageAttributesLine/ImageAttributesLine.test.js +187 -193
- package/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
- package/ImageAttributesLine/imageAttributeValues.test-data.js +22 -0
- package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +315 -298
- package/ImageDetailsView/ImageDetailsView.test.js +529 -55
- package/ImageDetailsView/attributes.test-data.d.ts +4 -1
- package/ImageDetailsView/attributes.test-data.js +98 -1
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
- package/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
- package/ImageDetailsView/helpers.test.js +4 -4
- package/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
- package/ImportButton/ImportButton.test.js +94 -24
- package/InlineAttributesList/InlineAttributesList.test.js +22 -62
- package/InlineAttributesList/attributes.test-data.d.ts +4 -2
- package/InlineAttributesList/attributes.test-data.js +40 -1
- package/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
- package/InlineAttributesPager/InlineAttributesPager.js +1 -4
- package/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
- package/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
- package/InlineComplexAttribute/InlineComplexAttribute.test.js +396 -182
- package/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
- package/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
- package/InlineReferenceAttribute/InlineReferenceAttribute.test.js +165 -107
- package/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +352 -346
- package/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +285 -194
- package/InternalLink/InternalLink.test.js +41 -11
- package/LookupEditor/LookupEditor.test.js +180 -44
- package/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
- package/MapChart/MapChart.js +3 -8
- package/MapChart/MapChart.test.js +152 -188
- package/MapChart/components/Legend/Legend.js +3 -3
- package/MaskingSwitcher/MaskingSwitcher.js +1 -1
- package/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
- package/SelectEditor/SelectEditor.d.ts +4 -10
- package/SelectEditor/SelectEditor.js +0 -4
- package/SelectEditor/SelectEditor.test.js +79 -9
- package/cjs/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/cjs/ChartTooltip/ChartTooltip.js +3 -3
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/cjs/DropDownMenuButton/DropDownMenuButton.js +1 -1
- package/cjs/HOCs/withAsyncMount/withAsyncMount.test.js +56 -56
- package/cjs/IgnoreButton/IgnoreButton.spec.js +109 -20
- package/cjs/Image/Image.d.ts +1 -1
- package/cjs/Image/Image.js +8 -8
- package/cjs/Image/Image.test.js +46 -51
- package/cjs/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
- package/cjs/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
- package/cjs/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
- package/cjs/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
- package/cjs/ImageAttributesLine/ImageAttributesLine.js +1 -1
- package/cjs/ImageAttributesLine/ImageAttributesLine.test.js +195 -224
- package/cjs/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
- package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +23 -1
- package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +316 -299
- package/cjs/ImageDetailsView/ImageDetailsView.test.js +529 -55
- package/cjs/ImageDetailsView/attributes.test-data.d.ts +4 -1
- package/cjs/ImageDetailsView/attributes.test-data.js +99 -2
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
- package/cjs/ImageDetailsView/helpers.test.js +3 -3
- package/cjs/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
- package/cjs/ImportButton/ImportButton.test.js +94 -24
- package/cjs/InlineAttributesList/InlineAttributesList.test.js +22 -62
- package/cjs/InlineAttributesList/attributes.test-data.d.ts +4 -2
- package/cjs/InlineAttributesList/attributes.test-data.js +41 -2
- package/cjs/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
- package/cjs/InlineAttributesPager/InlineAttributesPager.js +1 -4
- package/cjs/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
- package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +395 -204
- package/cjs/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
- package/cjs/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
- package/cjs/InlineReferenceAttribute/InlineReferenceAttribute.test.js +164 -106
- package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +351 -345
- package/cjs/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +307 -193
- package/cjs/InternalLink/InternalLink.test.js +40 -10
- package/cjs/LookupEditor/LookupEditor.test.js +178 -65
- package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
- package/cjs/MapChart/MapChart.js +3 -8
- package/cjs/MapChart/MapChart.test.js +152 -188
- package/cjs/MapChart/components/Legend/Legend.js +3 -3
- package/cjs/MaskingSwitcher/MaskingSwitcher.js +1 -1
- package/cjs/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
- package/cjs/SelectEditor/SelectEditor.d.ts +4 -10
- package/cjs/SelectEditor/SelectEditor.js +0 -4
- package/cjs/SelectEditor/SelectEditor.test.js +79 -9
- package/cjs/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
- package/cjs/hooks/useAsyncMount/useAsyncMount.js +1 -1
- package/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
- package/hooks/useAsyncMount/useAsyncMount.js +1 -1
- package/package.json +1 -1
- package/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
- package/HOCs/withTableContext/withTableContext.test.js +0 -41
- package/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
- package/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -98
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
- package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -99
- package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
- package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -65
- package/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -306
- package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -134
- package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -99
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -36
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
- package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -161
- package/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
- package/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -76
- package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -104
- package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -114
- package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
- package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -177
- package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
- package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -52
- package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
- package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -37
- package/cjs/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
- package/cjs/HOCs/withTableContext/withTableContext.test.js +0 -46
- package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
- package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -103
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -104
- package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -70
- package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -311
- package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -139
- package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -104
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -41
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -166
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
- package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -81
- package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -109
- package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -119
- package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
- package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -182
- package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
- package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -57
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
- package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -42
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var ramda_1 = require("ramda");
|
|
19
|
-
var test_utils_1 = require("react-dom/test-utils");
|
|
20
|
-
var enzyme_1 = require("enzyme");
|
|
21
|
-
var LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
|
|
22
|
-
var AdapterMoment_1 = require("@mui/x-date-pickers/AdapterMoment");
|
|
23
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
24
|
-
var styles_1 = require("@mui/material/styles");
|
|
25
|
-
var MetaInfoHeader_1 = require("../MetaInfoHeader");
|
|
26
|
-
var MetaInfoList_1 = require("../MetaInfoList");
|
|
27
|
-
var MetaInfoForm_1 = require("../MetaInfoForm");
|
|
28
|
-
var attributes_test_data_1 = require("../../attributes.test-data");
|
|
29
|
-
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
30
|
-
var MetaInfo_1 = require("./MetaInfo");
|
|
31
|
-
jest.mock('../MetaInfoForm', function () { return ({ MetaInfoForm: function () { return null; } }); });
|
|
32
|
-
jest.mock('../MetaInfoHeader', function () { return ({ MetaInfoHeader: function () { return null; } }); });
|
|
33
|
-
jest.mock('../MetaInfoList', function () { return ({ MetaInfoList: function () { return null; } }); });
|
|
34
|
-
var modifyAttribute = jest.fn();
|
|
35
|
-
var setUp = function (mode) {
|
|
36
|
-
if (mode === void 0) { mode = mdm_sdk_1.Mode.Viewing; }
|
|
37
|
-
var props = { attributeValue: attributes_test_data_1.attributeValue, attributeType: attributes_test_data_1.attributeType, imageAttributeFieldsOrder: {} };
|
|
38
|
-
var Component = function (props) { return (react_1.default.createElement(LocalizationProvider_1.LocalizationProvider, { dateAdapter: AdapterMoment_1.AdapterMoment },
|
|
39
|
-
react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: { mode: mode }, actions: { modifyAttribute: modifyAttribute } },
|
|
40
|
-
react_1.default.createElement(MetaInfo_1.MetaInfo, __assign({}, props))))); };
|
|
41
|
-
return (0, enzyme_1.mount)(react_1.default.createElement(Component, __assign({}, props)));
|
|
42
|
-
};
|
|
43
|
-
describe('MetaInfo tests', function () {
|
|
44
|
-
describe('render tests', function () {
|
|
45
|
-
it('should render ThemeProvider correctly', function () {
|
|
46
|
-
var component = setUp(mdm_sdk_1.Mode.Viewing);
|
|
47
|
-
expect(component.find(styles_1.ThemeProvider)).toHaveLength(1);
|
|
48
|
-
});
|
|
49
|
-
it('should render MetaInfoHeader correctly', function () {
|
|
50
|
-
var component = setUp(mdm_sdk_1.Mode.Viewing);
|
|
51
|
-
expect(component.find(MetaInfoHeader_1.MetaInfoHeader).props()).toMatchObject({
|
|
52
|
-
attributeType: attributes_test_data_1.attributeType,
|
|
53
|
-
uri: attributes_test_data_1.attributeValue.uri
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
it('should pass correctly onAddAttributes prop to MetaInfoHeader if mode is "Viewing"', function () {
|
|
57
|
-
var component = setUp(mdm_sdk_1.Mode.Viewing);
|
|
58
|
-
expect(component.find(MetaInfoHeader_1.MetaInfoHeader).prop('onAddAttributes')).toBeUndefined();
|
|
59
|
-
});
|
|
60
|
-
it('should pass correctly onAddAttributes prop to MetaInfoHeader if mode is "Editing"', function () {
|
|
61
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
62
|
-
expect(component.find(MetaInfoHeader_1.MetaInfoHeader).prop('onAddAttributes')).toBeDefined();
|
|
63
|
-
});
|
|
64
|
-
it('should pass correctly onAddAttributes prop to MetaInfoHeader if mode is "Suggesting"', function () {
|
|
65
|
-
var component = setUp(mdm_sdk_1.Mode.Suggesting);
|
|
66
|
-
expect(component.find(MetaInfoHeader_1.MetaInfoHeader).prop('onAddAttributes')).toBeDefined();
|
|
67
|
-
});
|
|
68
|
-
it('should render MetaInfoList correctly', function () {
|
|
69
|
-
var component = setUp(mdm_sdk_1.Mode.Viewing);
|
|
70
|
-
expect(component.find(MetaInfoList_1.MetaInfoList).props()).toMatchObject({
|
|
71
|
-
attributeType: attributes_test_data_1.attributeType,
|
|
72
|
-
attributeValue: attributes_test_data_1.attributeValue,
|
|
73
|
-
imageAttributeFieldsOrder: {}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
var checkMetaInfoForm = function (component, mode) {
|
|
77
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).props()).toMatchObject({
|
|
78
|
-
mode: mode,
|
|
79
|
-
imageAttributeFieldsOrder: {},
|
|
80
|
-
attributeType: attributes_test_data_1.attributeType,
|
|
81
|
-
attributeValue: attributes_test_data_1.attributeValue,
|
|
82
|
-
hasChanges: false
|
|
83
|
-
});
|
|
84
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('onDeleteAttribute')).toBeDefined();
|
|
85
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('onChangeAttribute')).toBeDefined();
|
|
86
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('onAddAttributes')).toBeDefined();
|
|
87
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('onCancel')).toBeDefined();
|
|
88
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('onApply')).toBeDefined();
|
|
89
|
-
};
|
|
90
|
-
it('should render MetaInfoForm correctly if mode is "Editing"', function () {
|
|
91
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
92
|
-
checkMetaInfoForm(component, mdm_sdk_1.Mode.Editing);
|
|
93
|
-
});
|
|
94
|
-
it('should render MetaInfoForm correctly if mode is "Suggesting"', function () {
|
|
95
|
-
var component = setUp(mdm_sdk_1.Mode.Suggesting);
|
|
96
|
-
checkMetaInfoForm(component, mdm_sdk_1.Mode.Suggesting);
|
|
97
|
-
});
|
|
98
|
-
it('should not render MetaInfoForm if mode is "Viewing"', function () {
|
|
99
|
-
var component = setUp(mdm_sdk_1.Mode.Viewing);
|
|
100
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm)).toHaveLength(0);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
describe('useEditMetaInfo', function () {
|
|
104
|
-
beforeEach(function () {
|
|
105
|
-
jest.restoreAllMocks();
|
|
106
|
-
});
|
|
107
|
-
it('should return attributeValue correctly', function () {
|
|
108
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
109
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue')).toEqual(attributes_test_data_1.attributeValue);
|
|
110
|
-
});
|
|
111
|
-
it('addAttributes should work correctly for existing attributes', function () {
|
|
112
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
113
|
-
var onAddAttributes = component.find(MetaInfoForm_1.MetaInfoForm).prop('onAddAttributes');
|
|
114
|
-
var attributes = [
|
|
115
|
-
{
|
|
116
|
-
parentUri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM',
|
|
117
|
-
index: undefined,
|
|
118
|
-
attributeType: {
|
|
119
|
-
label: 'String',
|
|
120
|
-
name: 'String',
|
|
121
|
-
type: 'String',
|
|
122
|
-
system: false,
|
|
123
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String'
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
];
|
|
127
|
-
(0, test_utils_1.act)(function () {
|
|
128
|
-
onAddAttributes(attributes);
|
|
129
|
-
});
|
|
130
|
-
component.update();
|
|
131
|
-
var updatedAttributeValue = component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue');
|
|
132
|
-
var string = updatedAttributeValue.value.String;
|
|
133
|
-
expect(string[1]).toEqual(attributes_test_data_1.attributeValue.value.String[0]);
|
|
134
|
-
expect(string[0].value).toBe('');
|
|
135
|
-
expect(string[0].type).toBe('configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String');
|
|
136
|
-
expect(string[0].uri.startsWith('entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String')).toBe(true);
|
|
137
|
-
});
|
|
138
|
-
it('addAttributes should work correctly for not existing attributes', function () {
|
|
139
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
140
|
-
var onAddAttributes = component.find(MetaInfoHeader_1.MetaInfoHeader).prop('onAddAttributes');
|
|
141
|
-
var attributes = [
|
|
142
|
-
{
|
|
143
|
-
attributeType: {
|
|
144
|
-
label: 'Float',
|
|
145
|
-
name: 'Float',
|
|
146
|
-
type: 'Float',
|
|
147
|
-
system: false,
|
|
148
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Float'
|
|
149
|
-
},
|
|
150
|
-
parentUri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM'
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
attributeType: {
|
|
154
|
-
label: 'Long',
|
|
155
|
-
name: 'Long',
|
|
156
|
-
type: 'Long',
|
|
157
|
-
system: false,
|
|
158
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Long'
|
|
159
|
-
},
|
|
160
|
-
parentUri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM'
|
|
161
|
-
}
|
|
162
|
-
];
|
|
163
|
-
(0, test_utils_1.act)(function () {
|
|
164
|
-
if (onAddAttributes) {
|
|
165
|
-
onAddAttributes(attributes);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
component.update();
|
|
169
|
-
var updatedAttributeValue = component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue');
|
|
170
|
-
var float = updatedAttributeValue.value.Float;
|
|
171
|
-
expect(float[0].value).toBe('');
|
|
172
|
-
expect(float[0].type).toBe('configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Float');
|
|
173
|
-
expect(float[0].uri.startsWith('entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/Float')).toBe(true);
|
|
174
|
-
var long = updatedAttributeValue.value.Long;
|
|
175
|
-
expect(long[0].value).toBe('');
|
|
176
|
-
expect(long[0].type).toBe('configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Long');
|
|
177
|
-
expect(long[0].uri.startsWith('entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/Long')).toBe(true);
|
|
178
|
-
});
|
|
179
|
-
it('changeAttribute handler should work correctly', function () {
|
|
180
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
181
|
-
var onChangeAttribute = component.find(MetaInfoForm_1.MetaInfoForm).prop('onChangeAttribute');
|
|
182
|
-
var changes = {
|
|
183
|
-
value: 'hello',
|
|
184
|
-
attributeType: {
|
|
185
|
-
label: 'String',
|
|
186
|
-
name: 'String',
|
|
187
|
-
type: 'String',
|
|
188
|
-
system: false,
|
|
189
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String'
|
|
190
|
-
},
|
|
191
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String/3aL9d8oMS'
|
|
192
|
-
};
|
|
193
|
-
(0, test_utils_1.act)(function () {
|
|
194
|
-
onChangeAttribute(changes);
|
|
195
|
-
});
|
|
196
|
-
component.update();
|
|
197
|
-
var expectedResult = __assign(__assign({}, attributes_test_data_1.attributeValue), { value: __assign(__assign({}, attributes_test_data_1.attributeValue.value), { String: [
|
|
198
|
-
__assign(__assign({}, attributes_test_data_1.attributeValue.value.String[0]), { value: 'hello' }),
|
|
199
|
-
attributes_test_data_1.attributeValue.value.String[1]
|
|
200
|
-
] }) });
|
|
201
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue')).toEqual(expectedResult);
|
|
202
|
-
});
|
|
203
|
-
it('deleteAttribute handler should work correctly', function () {
|
|
204
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
205
|
-
var onDeleteAttribute = component.find(MetaInfoForm_1.MetaInfoForm).prop('onDeleteAttribute');
|
|
206
|
-
var changes = {
|
|
207
|
-
attributeType: {
|
|
208
|
-
label: 'Date',
|
|
209
|
-
name: 'Date',
|
|
210
|
-
type: 'Date',
|
|
211
|
-
system: false,
|
|
212
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Date'
|
|
213
|
-
},
|
|
214
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/Date/uri$$1626678310141'
|
|
215
|
-
};
|
|
216
|
-
(0, test_utils_1.act)(function () {
|
|
217
|
-
onDeleteAttribute(changes);
|
|
218
|
-
});
|
|
219
|
-
component.update();
|
|
220
|
-
var expectedResult = __assign(__assign({}, attributes_test_data_1.attributeValue), { value: __assign({}, (0, ramda_1.fromPairs)((0, ramda_1.toPairs)(attributes_test_data_1.attributeValue.value).filter(function (_a) {
|
|
221
|
-
var key = _a[0];
|
|
222
|
-
return key !== 'Date';
|
|
223
|
-
}))) });
|
|
224
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue')).toEqual(expectedResult);
|
|
225
|
-
});
|
|
226
|
-
it('clearLocalChanges should work correctly', function () {
|
|
227
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
228
|
-
var onCancel = component.find(MetaInfoForm_1.MetaInfoForm).prop('onCancel');
|
|
229
|
-
var onChangeAttribute = component.find(MetaInfoForm_1.MetaInfoForm).prop('onChangeAttribute');
|
|
230
|
-
var changes = {
|
|
231
|
-
value: 'hello',
|
|
232
|
-
attributeType: {
|
|
233
|
-
label: 'String',
|
|
234
|
-
name: 'String',
|
|
235
|
-
type: 'String',
|
|
236
|
-
system: false,
|
|
237
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String'
|
|
238
|
-
},
|
|
239
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String/3aL9d8oMS'
|
|
240
|
-
};
|
|
241
|
-
(0, test_utils_1.act)(function () {
|
|
242
|
-
onChangeAttribute(changes);
|
|
243
|
-
});
|
|
244
|
-
component.update();
|
|
245
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue')).not.toEqual(attributes_test_data_1.attributeValue);
|
|
246
|
-
(0, test_utils_1.act)(function () {
|
|
247
|
-
onCancel();
|
|
248
|
-
});
|
|
249
|
-
component.update();
|
|
250
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue')).toEqual(attributes_test_data_1.attributeValue);
|
|
251
|
-
});
|
|
252
|
-
it('applyLocalChanges should work correctly', function () {
|
|
253
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
254
|
-
var onApply = component.find(MetaInfoForm_1.MetaInfoForm).prop('onApply');
|
|
255
|
-
(0, test_utils_1.act)(function () {
|
|
256
|
-
onApply();
|
|
257
|
-
});
|
|
258
|
-
component.update();
|
|
259
|
-
expect(modifyAttribute).toHaveBeenCalledWith({
|
|
260
|
-
value: attributes_test_data_1.attributeValue,
|
|
261
|
-
attributeType: attributes_test_data_1.attributeType,
|
|
262
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM'
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
it('should return hasChanges correctly', function () {
|
|
266
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
267
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('hasChanges')).toBe(false);
|
|
268
|
-
var onCancel = component.find(MetaInfoForm_1.MetaInfoForm).prop('onCancel');
|
|
269
|
-
var onChangeAttribute = component.find(MetaInfoForm_1.MetaInfoForm).prop('onChangeAttribute');
|
|
270
|
-
var changes = {
|
|
271
|
-
value: 'hello',
|
|
272
|
-
attributeType: {
|
|
273
|
-
label: 'String',
|
|
274
|
-
name: 'String',
|
|
275
|
-
type: 'String',
|
|
276
|
-
system: false,
|
|
277
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String'
|
|
278
|
-
},
|
|
279
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String/3aL9d8oMS'
|
|
280
|
-
};
|
|
281
|
-
(0, test_utils_1.act)(function () {
|
|
282
|
-
onChangeAttribute(changes);
|
|
283
|
-
});
|
|
284
|
-
component.update();
|
|
285
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('hasChanges')).toBe(true);
|
|
286
|
-
(0, test_utils_1.act)(function () {
|
|
287
|
-
onCancel();
|
|
288
|
-
});
|
|
289
|
-
component.update();
|
|
290
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('hasChanges')).toBe(false);
|
|
291
|
-
});
|
|
292
|
-
it('should reflect value update', function () {
|
|
293
|
-
var component = setUp(mdm_sdk_1.Mode.Editing);
|
|
294
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue')).toEqual(attributes_test_data_1.attributeValue);
|
|
295
|
-
var newValue = (0, ramda_1.clone)(attributes_test_data_1.attributeValue);
|
|
296
|
-
newValue.value.Size = [
|
|
297
|
-
{
|
|
298
|
-
type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Size',
|
|
299
|
-
ov: true,
|
|
300
|
-
value: '4444',
|
|
301
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/Size/3aL9d8bZg'
|
|
302
|
-
}
|
|
303
|
-
];
|
|
304
|
-
(0, test_utils_1.act)(function () {
|
|
305
|
-
component.setProps({ attributeValue: newValue });
|
|
306
|
-
});
|
|
307
|
-
component.update();
|
|
308
|
-
expect(component.find(MetaInfoForm_1.MetaInfoForm).prop('attributeValue')).toEqual(newValue);
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var enzyme_1 = require("enzyme");
|
|
19
|
-
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
20
|
-
var EditModeAttributesPager_1 = require("../../../EditModeAttributesPager");
|
|
21
|
-
var attributes_test_data_1 = require("../../attributes.test-data");
|
|
22
|
-
var MetaInfoForm_1 = require("./MetaInfoForm");
|
|
23
|
-
var onDeleteAttribute = jest.fn();
|
|
24
|
-
var onChangeAttribute = jest.fn();
|
|
25
|
-
var onAddAttributes = jest.fn();
|
|
26
|
-
var onCancel = jest.fn();
|
|
27
|
-
var onApply = jest.fn();
|
|
28
|
-
var setUp = function (attrValue, hasChanges) {
|
|
29
|
-
if (hasChanges === void 0) { hasChanges = false; }
|
|
30
|
-
var props = {
|
|
31
|
-
attributeType: attributes_test_data_1.attributeType,
|
|
32
|
-
attributeValue: attrValue || attributes_test_data_1.attributeValue,
|
|
33
|
-
imageAttributeFieldsOrder: {},
|
|
34
|
-
mode: mdm_sdk_1.Mode.Editing,
|
|
35
|
-
onDeleteAttribute: onDeleteAttribute,
|
|
36
|
-
onChangeAttribute: onChangeAttribute,
|
|
37
|
-
onAddAttributes: onAddAttributes,
|
|
38
|
-
onCancel: onCancel,
|
|
39
|
-
onApply: onApply,
|
|
40
|
-
hasChanges: hasChanges
|
|
41
|
-
};
|
|
42
|
-
return (0, enzyme_1.shallow)(react_1.default.createElement(MetaInfoForm_1.MetaInfoForm, __assign({}, props)));
|
|
43
|
-
};
|
|
44
|
-
describe('MetaInfoForm tests', function () {
|
|
45
|
-
it('should render not system attributes correctly', function () {
|
|
46
|
-
var component = setUp();
|
|
47
|
-
expect(component.find(EditModeAttributesPager_1.EditModeAttributesPager).at(0).props()).toMatchObject({
|
|
48
|
-
parentUri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM',
|
|
49
|
-
attributeType: {
|
|
50
|
-
label: 'String',
|
|
51
|
-
name: 'String',
|
|
52
|
-
type: 'String',
|
|
53
|
-
system: false,
|
|
54
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String'
|
|
55
|
-
},
|
|
56
|
-
values: [
|
|
57
|
-
{
|
|
58
|
-
type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String',
|
|
59
|
-
ov: true,
|
|
60
|
-
value: 'rere',
|
|
61
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String/3aL9d8oMS'
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String',
|
|
65
|
-
value: '',
|
|
66
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/String/uri$$1626678443648'
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
mode: mdm_sdk_1.Mode.Editing,
|
|
70
|
-
onDeleteAttribute: onDeleteAttribute,
|
|
71
|
-
onChangeAttribute: onChangeAttribute,
|
|
72
|
-
onAddAttributes: onAddAttributes
|
|
73
|
-
});
|
|
74
|
-
expect(component.find(EditModeAttributesPager_1.EditModeAttributesPager).at(1).props()).toMatchObject({
|
|
75
|
-
parentUri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM',
|
|
76
|
-
attributeType: {
|
|
77
|
-
label: 'Date',
|
|
78
|
-
name: 'Date',
|
|
79
|
-
type: 'Date',
|
|
80
|
-
system: false,
|
|
81
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Date'
|
|
82
|
-
},
|
|
83
|
-
values: [
|
|
84
|
-
{
|
|
85
|
-
value: '2021-07-07',
|
|
86
|
-
uri: 'entities/15RRKaId/attributes/ImageGallery/3aL9d7zDM/Date/uri$$1626678310141',
|
|
87
|
-
type: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Date'
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
mode: mdm_sdk_1.Mode.Editing,
|
|
91
|
-
onDeleteAttribute: onDeleteAttribute,
|
|
92
|
-
onChangeAttribute: onChangeAttribute,
|
|
93
|
-
onAddAttributes: onAddAttributes
|
|
94
|
-
});
|
|
95
|
-
expect(component.find(EditModeAttributesPager_1.EditModeAttributesPager)).toHaveLength(2);
|
|
96
|
-
});
|
|
97
|
-
it('should render buttons and divider if attributeValue has not system attributes', function () {
|
|
98
|
-
var component = setUp();
|
|
99
|
-
expect(component.find('.divider')).toHaveLength(1);
|
|
100
|
-
expect(component.find('.actions')).toHaveLength(1);
|
|
101
|
-
});
|
|
102
|
-
it('should render buttons and divider if attributeValue has not notSystemAttributes, but hasChanges is "true"', function () {
|
|
103
|
-
var attrValue = {
|
|
104
|
-
value: {},
|
|
105
|
-
uri: 'uri'
|
|
106
|
-
};
|
|
107
|
-
var component = setUp(attrValue, true);
|
|
108
|
-
expect(component.find('.divider')).toHaveLength(1);
|
|
109
|
-
expect(component.find('.actions')).toHaveLength(1);
|
|
110
|
-
});
|
|
111
|
-
it('should not render buttons and divider if attributeValue has not notSystemAttributes and hasChanges is "false"', function () {
|
|
112
|
-
var attrValue = {
|
|
113
|
-
value: {},
|
|
114
|
-
uri: 'uri'
|
|
115
|
-
};
|
|
116
|
-
var component = setUp(attrValue);
|
|
117
|
-
expect(component.find('.divider')).toHaveLength(0);
|
|
118
|
-
expect(component.find('.actions')).toHaveLength(0);
|
|
119
|
-
});
|
|
120
|
-
it('should disable buttons if hasChanges is "false"', function () {
|
|
121
|
-
var component = setUp();
|
|
122
|
-
component
|
|
123
|
-
.find('.actions')
|
|
124
|
-
.children()
|
|
125
|
-
.forEach(function (node) {
|
|
126
|
-
expect(node.prop('disabled')).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
it('onCancel handler should work correctly', function () {
|
|
130
|
-
var component = setUp();
|
|
131
|
-
component.find('.actions').childAt(0).simulate('click');
|
|
132
|
-
expect(onCancel).toHaveBeenCalled();
|
|
133
|
-
});
|
|
134
|
-
it('onApply handler should work correctly', function () {
|
|
135
|
-
var component = setUp();
|
|
136
|
-
component.find('.actions').childAt(1).simulate('click');
|
|
137
|
-
expect(onApply).toHaveBeenCalled();
|
|
138
|
-
});
|
|
139
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var enzyme_1 = require("enzyme");
|
|
19
|
-
var test_utils_1 = require("react-dom/test-utils");
|
|
20
|
-
var MoreAttributesButton_1 = require("../../../MoreAttributesButton");
|
|
21
|
-
var MetaInfoHeader_1 = require("./MetaInfoHeader");
|
|
22
|
-
var systemAttribute = {
|
|
23
|
-
label: 'Full image url (S3)',
|
|
24
|
-
name: 'Url',
|
|
25
|
-
type: 'String',
|
|
26
|
-
hidden: false,
|
|
27
|
-
important: false,
|
|
28
|
-
system: true,
|
|
29
|
-
searchable: true,
|
|
30
|
-
attributeOrdering: { orderingStrategy: 'LUD' },
|
|
31
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/Url',
|
|
32
|
-
skipInDataAccess: false,
|
|
33
|
-
access: [
|
|
34
|
-
'DELETE',
|
|
35
|
-
'UNMERGE',
|
|
36
|
-
'UPDATE',
|
|
37
|
-
'READ',
|
|
38
|
-
'INITIATE_CHANGE_REQUEST',
|
|
39
|
-
'MERGE',
|
|
40
|
-
'ACCEPT_CHANGE_REQUEST',
|
|
41
|
-
'CREATE'
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
var notSystemAttribute = {
|
|
45
|
-
label: 'String',
|
|
46
|
-
name: 'String',
|
|
47
|
-
type: 'String',
|
|
48
|
-
hidden: false,
|
|
49
|
-
important: false,
|
|
50
|
-
system: false,
|
|
51
|
-
attributeOrdering: { orderingStrategy: 'LUD' },
|
|
52
|
-
uri: 'configuration/entityTypes/HCP/attributes/ImageGallery/attributes/String',
|
|
53
|
-
skipInDataAccess: false,
|
|
54
|
-
access: [
|
|
55
|
-
'DELETE',
|
|
56
|
-
'UNMERGE',
|
|
57
|
-
'UPDATE',
|
|
58
|
-
'READ',
|
|
59
|
-
'INITIATE_CHANGE_REQUEST',
|
|
60
|
-
'MERGE',
|
|
61
|
-
'ACCEPT_CHANGE_REQUEST',
|
|
62
|
-
'CREATE'
|
|
63
|
-
]
|
|
64
|
-
};
|
|
65
|
-
var attributeType = {
|
|
66
|
-
attributes: [systemAttribute, notSystemAttribute]
|
|
67
|
-
};
|
|
68
|
-
var uri = 'entities/123/attributes/ImageGallery/1321';
|
|
69
|
-
var onAddAttributes = jest.fn();
|
|
70
|
-
var setUp = function (hasOnAddAttributes) {
|
|
71
|
-
var props = {
|
|
72
|
-
attributeType: attributeType,
|
|
73
|
-
uri: uri,
|
|
74
|
-
onAddAttributes: hasOnAddAttributes ? onAddAttributes : undefined
|
|
75
|
-
};
|
|
76
|
-
return (0, enzyme_1.shallow)(react_1.default.createElement(MetaInfoHeader_1.MetaInfoHeader, __assign({}, props)));
|
|
77
|
-
};
|
|
78
|
-
describe('MetaInfoHeader tests', function () {
|
|
79
|
-
it('should render title className correctly if onAddAttributes exists', function () {
|
|
80
|
-
var component = setUp(true);
|
|
81
|
-
expect(component.find('.title').prop('className')).toBe('title canAdd');
|
|
82
|
-
});
|
|
83
|
-
it('should render title className correctly if onAddAttributes not exists', function () {
|
|
84
|
-
var component = setUp(false);
|
|
85
|
-
expect(component.find('.title').prop('className')).toBe('title');
|
|
86
|
-
});
|
|
87
|
-
it('should not render MoreAttributesButton and divider if onAddAttributes not exists', function () {
|
|
88
|
-
var component = setUp(false);
|
|
89
|
-
expect(component.find(MoreAttributesButton_1.MoreAttributesButton)).toHaveLength(0);
|
|
90
|
-
expect(component.find('.divider')).toHaveLength(0);
|
|
91
|
-
});
|
|
92
|
-
it('should render MoreAttributesButton and divider correctly if onAddAttributes exists', function () {
|
|
93
|
-
var component = setUp(true);
|
|
94
|
-
expect(component.find(MoreAttributesButton_1.MoreAttributesButton).prop('data')).toEqual([notSystemAttribute]);
|
|
95
|
-
expect(component.find('.divider')).toHaveLength(1);
|
|
96
|
-
});
|
|
97
|
-
it('onAddAttributes handler should work correctly', function () {
|
|
98
|
-
var component = setUp(true);
|
|
99
|
-
(0, test_utils_1.act)(function () {
|
|
100
|
-
component.find(MoreAttributesButton_1.MoreAttributesButton).prop('onApply')([notSystemAttribute]);
|
|
101
|
-
});
|
|
102
|
-
expect(onAddAttributes).toHaveBeenCalledWith([{ attributeType: notSystemAttribute, parentUri: uri }]);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var react_1 = __importDefault(require("react"));
|
|
7
|
-
var enzyme_1 = require("enzyme");
|
|
8
|
-
var MetaInfoItem_1 = require("./MetaInfoItem");
|
|
9
|
-
describe('MetaInfoItem tests', function () {
|
|
10
|
-
it('should render span', function () {
|
|
11
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(MetaInfoItem_1.MetaInfoItem, { title: 'Name', content: 'Content' }));
|
|
12
|
-
var title = component.find('.title');
|
|
13
|
-
expect(title).toHaveLength(1);
|
|
14
|
-
expect(title.text()).toBe('Name');
|
|
15
|
-
expect(component.find('.link')).toHaveLength(0);
|
|
16
|
-
var content = component.find('.content');
|
|
17
|
-
expect(content).toHaveLength(1);
|
|
18
|
-
expect(content.text()).toBe('Content');
|
|
19
|
-
});
|
|
20
|
-
it('should render link', function () {
|
|
21
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(MetaInfoItem_1.MetaInfoItem, { title: 'Name', content: 'https://google.com', isLink: true }));
|
|
22
|
-
var title = component.find('.title');
|
|
23
|
-
expect(title).toHaveLength(1);
|
|
24
|
-
expect(title.text()).toBe('Name');
|
|
25
|
-
var link = component.find('.link');
|
|
26
|
-
expect(link).toHaveLength(1);
|
|
27
|
-
expect(link.prop('href')).toBe('https://google.com');
|
|
28
|
-
expect(component.find('.content')).toHaveLength(0);
|
|
29
|
-
});
|
|
30
|
-
it('should render child', function () {
|
|
31
|
-
var component = (0, enzyme_1.mount)(react_1.default.createElement(MetaInfoItem_1.MetaInfoItem, { title: 'Name' },
|
|
32
|
-
react_1.default.createElement("div", { className: 'onlyChild' }, "Sample! Not for sale!")));
|
|
33
|
-
var title = component.find('.title');
|
|
34
|
-
expect(title).toHaveLength(1);
|
|
35
|
-
expect(title.text()).toBe('Name');
|
|
36
|
-
expect(component.find('.content')).toHaveLength(1);
|
|
37
|
-
var child = component.find('.onlyChild');
|
|
38
|
-
expect(child.text()).toBe('Sample! Not for sale!');
|
|
39
|
-
expect(component.find('.link')).toHaveLength(0);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|