@reltio/components 1.4.2050 → 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/ColumnsSettings.d.ts +2 -1
- package/ColumnsSettings/ColumnsSettings.js +2 -2
- package/ColumnsSettings/ColumnsSettings.test.js +14 -0
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
- package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
- 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/SelectionPopup/SelectionPopup.d.ts +2 -1
- package/SelectionPopup/SelectionPopup.js +3 -3
- package/SelectionPopup/SelectionPopup.spec.js +90 -30
- package/cjs/AttributeListItem/AttributeListItem.d.ts +1 -1
- package/cjs/ChartTooltip/ChartTooltip.js +3 -3
- package/cjs/ColumnsSettings/ColumnsSettings.d.ts +2 -1
- package/cjs/ColumnsSettings/ColumnsSettings.js +2 -2
- package/cjs/ColumnsSettings/ColumnsSettings.test.js +14 -0
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
- package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
- 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/SelectionPopup/SelectionPopup.d.ts +2 -1
- package/cjs/SelectionPopup/SelectionPopup.js +3 -3
- package/cjs/SelectionPopup/SelectionPopup.spec.js +90 -30
- 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
|
@@ -9,32 +9,65 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
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
|
+
};
|
|
12
48
|
import React from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { Mode, insertDefaultImageByAttrUri } from '@reltio/mdm-sdk';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { ImageAttributesLineEditor } from './ImageAttributesLineEditor';
|
|
23
|
-
import { UploadImageDialog } from '../UploadImageDialog';
|
|
49
|
+
import { mockResizeObserver } from 'jsdom-testing-mocks';
|
|
50
|
+
import { act, fireEvent, render, screen, waitForElementToBeRemoved } from '@testing-library/react';
|
|
51
|
+
import userEvent from '@testing-library/user-event';
|
|
52
|
+
import { Mode, insertDefaultImageByAttrUri, uploadImage } from '@reltio/mdm-sdk';
|
|
53
|
+
import { ThemeProvider } from '@mui/styles';
|
|
54
|
+
import { createTheme } from '@mui/material/styles';
|
|
55
|
+
import { theme } from '../constants';
|
|
56
|
+
import { downloadImagesByURLs } from '../ImageAttributesLine/helpers';
|
|
57
|
+
import { attributeType, imageAttributeValues } from '../ImageAttributesLine/imageAttributeValues.test-data';
|
|
24
58
|
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}); });
|
|
59
|
+
import { ImageAttributesLineEditor } from './ImageAttributesLineEditor';
|
|
60
|
+
jest.unmock('@mui/styles');
|
|
61
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { insertDefaultImageByAttrUri: jest.fn().mockReturnValue({ then: function (f) { return f({ status: 'success' }); } }), uploadImage: jest.fn() })); });
|
|
28
62
|
jest.mock('../ImageAttributesLine/helpers', function () { return ({
|
|
29
63
|
downloadImagesByURLs: jest.fn()
|
|
30
64
|
}); });
|
|
31
|
-
|
|
32
|
-
var entity = { uri: 'entityuri' };
|
|
65
|
+
var entity = { uri: 'entities/1Rd2I9Mt' };
|
|
33
66
|
var modifiedEntities = {
|
|
34
|
-
|
|
35
|
-
defaultProfilePic: '
|
|
36
|
-
uri: '
|
|
37
|
-
type: 'configuration/entityTypes/
|
|
67
|
+
'entities/1Rd2I9Mt': {
|
|
68
|
+
defaultProfilePic: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv',
|
|
69
|
+
uri: 'entities/01eLeVm',
|
|
70
|
+
type: 'configuration/entityTypes/HCP'
|
|
38
71
|
}
|
|
39
72
|
};
|
|
40
73
|
var defaultMdmValues = {
|
|
@@ -43,10 +76,7 @@ var defaultMdmValues = {
|
|
|
43
76
|
mode: Mode.Viewing,
|
|
44
77
|
imageServicePath: '',
|
|
45
78
|
environment: '',
|
|
46
|
-
tenant: {
|
|
47
|
-
id: 'tenant',
|
|
48
|
-
name: 'tenant'
|
|
49
|
-
}
|
|
79
|
+
tenant: { id: 'tenant', name: 'tenant' }
|
|
50
80
|
};
|
|
51
81
|
var defaultMdmActions = {
|
|
52
82
|
setDefaultProfilePicForModifiedEntity: jest.fn(),
|
|
@@ -55,309 +85,296 @@ var defaultMdmActions = {
|
|
|
55
85
|
var onChangeAttribute = jest.fn();
|
|
56
86
|
var onDeleteAttribute = jest.fn();
|
|
57
87
|
var defaultProps = {
|
|
58
|
-
attributeValues:
|
|
59
|
-
attributeType:
|
|
60
|
-
|
|
61
|
-
type: '',
|
|
62
|
-
uri: 'uri',
|
|
63
|
-
attributes: [
|
|
64
|
-
{
|
|
65
|
-
name: 'CdnUrl',
|
|
66
|
-
type: 'String',
|
|
67
|
-
uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/CdnUrl'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'CdnUrlPreview',
|
|
71
|
-
type: 'String',
|
|
72
|
-
uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/CdnUrlPreview'
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'CdnUrlThumbnail',
|
|
76
|
-
type: 'String',
|
|
77
|
-
uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/CdnUrlThumbnail'
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'CreationTimestamp',
|
|
81
|
-
type: 'String',
|
|
82
|
-
uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/CdnUrlThumbnail'
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
parentUri: '1',
|
|
88
|
+
attributeValues: imageAttributeValues,
|
|
89
|
+
attributeType: attributeType,
|
|
90
|
+
parentUri: 'entities/01eLeVm',
|
|
87
91
|
onDeleteAttribute: onDeleteAttribute,
|
|
88
92
|
onChangeAttribute: onChangeAttribute
|
|
89
93
|
};
|
|
90
94
|
var setUp = function (_a) {
|
|
91
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ?
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? {} : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? {} : _d, _e = _b.mdmActions, mdmActions = _e === void 0 ? {} : _e;
|
|
96
|
+
var user = userEvent.setup({ skipHover: true });
|
|
97
|
+
var Providers = function (_a) {
|
|
98
|
+
var children = _a.children;
|
|
99
|
+
return (React.createElement(MdmModuleProvider, { values: __assign(__assign({}, defaultMdmValues), mdmValues), actions: __assign(__assign({}, defaultMdmActions), mdmActions) },
|
|
100
|
+
React.createElement(ThemeProvider, { theme: createTheme(theme) }, children)));
|
|
101
|
+
};
|
|
102
|
+
return __assign({ user: user }, render(React.createElement(ImageAttributesLineEditor, __assign({}, defaultProps, props)), { wrapper: Providers }));
|
|
94
103
|
};
|
|
95
104
|
describe('ImageAttributesLineEditor edit tests', function () {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
var resizeObserver = mockResizeObserver();
|
|
106
|
+
beforeEach(function () {
|
|
107
|
+
jest.clearAllMocks();
|
|
99
108
|
});
|
|
100
109
|
it('should render main parts', function () {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var requestNextPageOfAttributeValues = jest.fn();
|
|
107
|
-
var props = __assign(__assign({}, defaultProps), { attributeValues: imageAttributeValues, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, paging: {}, parentUri: 'parentUri', showNonOv: false });
|
|
108
|
-
var component = setUp({ props: props });
|
|
109
|
-
expect(component.find(ImageAttributesLine).props()).toMatchObject({
|
|
110
|
-
requestNextPageOfAttributeValues: expect.any(Function),
|
|
111
|
-
paging: {},
|
|
112
|
-
parentUri: 'parentUri',
|
|
113
|
-
showNonOv: false
|
|
110
|
+
setUp();
|
|
111
|
+
var container = screen.getByTestId('image-line-edit-mode');
|
|
112
|
+
resizeObserver.mockElementSize(container, { contentBoxSize: { inlineSize: 600 } });
|
|
113
|
+
act(function () {
|
|
114
|
+
resizeObserver.resize();
|
|
114
115
|
});
|
|
116
|
+
expect(screen.getByTestId('reltio-upload-image-button')).toBeInTheDocument();
|
|
117
|
+
var images = screen.getAllByRole('img', { hidden: true });
|
|
118
|
+
expect(images).toHaveLength(3);
|
|
115
119
|
});
|
|
116
120
|
it('should provide custom sizeImage to Image and ImageAttributesLine', function () {
|
|
117
121
|
var imageSize = { imageMargin: 40, imageWidth: 11, imageHeight: 3 };
|
|
118
|
-
|
|
119
|
-
var
|
|
122
|
+
setUp({ props: { imageSize: imageSize } });
|
|
123
|
+
var container = screen.getByTestId('image-line-edit-mode');
|
|
124
|
+
resizeObserver.mockElementSize(container, { contentBoxSize: { inlineSize: 300 } });
|
|
120
125
|
act(function () {
|
|
121
|
-
|
|
122
|
-
onResize(600);
|
|
123
|
-
});
|
|
124
|
-
component.update();
|
|
125
|
-
expect(component.find(Image)).toHaveLength(3);
|
|
126
|
-
var image = component.find(Image).first();
|
|
127
|
-
expect(image.prop('size')).toEqual({
|
|
128
|
-
imageWidth: imageSize.imageWidth,
|
|
129
|
-
imageHeight: imageSize.imageHeight
|
|
126
|
+
resizeObserver.resize();
|
|
130
127
|
});
|
|
131
|
-
|
|
128
|
+
var images = screen.getAllByRole('img', { hidden: true });
|
|
129
|
+
expect(images).toHaveLength(3);
|
|
130
|
+
var computedStyles = getComputedStyle(images[0]);
|
|
131
|
+
expect(computedStyles.width).toBe('11px');
|
|
132
|
+
expect(computedStyles.height).toBe('3px');
|
|
132
133
|
});
|
|
133
134
|
it('should render images', function () {
|
|
134
|
-
|
|
135
|
-
var
|
|
135
|
+
setUp({ props: { attributeValues: imageAttributeValues } });
|
|
136
|
+
var container = screen.getByTestId('image-line-edit-mode');
|
|
137
|
+
resizeObserver.mockElementSize(container, { contentBoxSize: { inlineSize: 600 } });
|
|
136
138
|
act(function () {
|
|
137
|
-
|
|
138
|
-
onResize(600);
|
|
139
|
+
resizeObserver.resize();
|
|
139
140
|
});
|
|
140
|
-
|
|
141
|
-
var images = component.find(Image);
|
|
141
|
+
var images = screen.getAllByRole('img', { hidden: true });
|
|
142
142
|
expect(images).toHaveLength(3);
|
|
143
|
-
expect(images
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
var props = __assign(__assign({}, defaultProps), { attributeValues: imageAttributeValues });
|
|
147
|
-
var component = setUp({ props: props });
|
|
148
|
-
act(function () {
|
|
149
|
-
var onResize = component.find(ReactResizeDetector).prop('onResize');
|
|
150
|
-
onResize(600);
|
|
151
|
-
});
|
|
152
|
-
component.update();
|
|
153
|
-
expect(component.find(ImageAttributesGallery).prop('open')).toBe(false);
|
|
154
|
-
act(function () {
|
|
155
|
-
component.find(Image).first().find('img').simulate('load');
|
|
156
|
-
});
|
|
157
|
-
component.update();
|
|
158
|
-
act(function () {
|
|
159
|
-
var _a;
|
|
160
|
-
(_a = component.find(ImageActionsOverlay).first().prop('onClick')) === null || _a === void 0 ? void 0 : _a();
|
|
161
|
-
});
|
|
162
|
-
component.update();
|
|
163
|
-
expect(component.find(ImageAttributesGallery).prop('open')).toBe(true);
|
|
143
|
+
expect(images[0]).toHaveAttribute('src', '/test.jpg');
|
|
144
|
+
expect(images[1]).toHaveAttribute('src', '/test2.jpg');
|
|
145
|
+
expect(images[2]).toHaveAttribute('src', '/wrong.jpg');
|
|
164
146
|
});
|
|
165
|
-
it('should
|
|
166
|
-
var
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
(_a = firstImageOverlay.prop('onSetAsDefault')) === null || _a === void 0 ? void 0 : _a();
|
|
194
|
-
});
|
|
195
|
-
expect(insertDefaultImageByAttrUri).toHaveBeenCalledWith('entityuri', imageAttributeValues[0].uri);
|
|
196
|
-
expect(setDefaultProfilePicForEntity).toHaveBeenCalledWith(imageAttributeValues[0]);
|
|
197
|
-
act(function () {
|
|
198
|
-
var _a;
|
|
199
|
-
(_a = firstImageOverlay.prop('onDelete')) === null || _a === void 0 ? void 0 : _a();
|
|
200
|
-
});
|
|
201
|
-
expect(defaultProps.onDeleteAttribute).toHaveBeenCalledWith({
|
|
202
|
-
uri: imageAttributeValues[0].uri,
|
|
203
|
-
attributeType: defaultProps.attributeType
|
|
147
|
+
it('should open gallery dialog on image overlay click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
+
var user, container;
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
switch (_a.label) {
|
|
151
|
+
case 0:
|
|
152
|
+
user = setUp({ props: { attributeValues: imageAttributeValues } }).user;
|
|
153
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
154
|
+
container = screen.getByTestId('image-line-edit-mode');
|
|
155
|
+
resizeObserver.mockElementSize(container, { contentBoxSize: { inlineSize: 600 } });
|
|
156
|
+
act(function () {
|
|
157
|
+
resizeObserver.resize();
|
|
158
|
+
});
|
|
159
|
+
return [4 /*yield*/, user.click(screen.getAllByRole('img', { hidden: true })[0])];
|
|
160
|
+
case 1:
|
|
161
|
+
_a.sent();
|
|
162
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
163
|
+
expect(screen.getByTestId('thumbnails-container').childNodes).toHaveLength(3);
|
|
164
|
+
expect(screen.getByText('Gallery')).toBeInTheDocument();
|
|
165
|
+
expect(screen.getByText('Meta info')).toBeInTheDocument();
|
|
166
|
+
expect(screen.getAllByTestId('image-meta-info-item')[0].querySelector('a')).toHaveAttribute('href', '/test.jpg');
|
|
167
|
+
return [4 /*yield*/, user.click(screen.getByLabelText('Close'))];
|
|
168
|
+
case 2:
|
|
169
|
+
_a.sent();
|
|
170
|
+
return [4 /*yield*/, waitForElementToBeRemoved(screen.queryByRole('dialog'))];
|
|
171
|
+
case 3:
|
|
172
|
+
_a.sent();
|
|
173
|
+
return [2 /*return*/];
|
|
174
|
+
}
|
|
204
175
|
});
|
|
205
|
-
});
|
|
206
|
-
it('should
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
176
|
+
}); });
|
|
177
|
+
it('should call image overlay actions', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
178
|
+
var user, container, clipboardText;
|
|
179
|
+
return __generator(this, function (_a) {
|
|
180
|
+
switch (_a.label) {
|
|
181
|
+
case 0:
|
|
182
|
+
user = setUp({ props: { attributeValues: imageAttributeValues, overlay: true } }).user;
|
|
183
|
+
container = screen.getByTestId('image-line-edit-mode');
|
|
184
|
+
resizeObserver.mockElementSize(container, { contentBoxSize: { inlineSize: 600 } });
|
|
185
|
+
act(function () {
|
|
186
|
+
resizeObserver.resize();
|
|
187
|
+
});
|
|
188
|
+
fireEvent.load(screen.getAllByRole('img', { hidden: true })[0]);
|
|
189
|
+
return [4 /*yield*/, user.hover(screen.getByTestId('image-actions-overlay'))];
|
|
190
|
+
case 1:
|
|
191
|
+
_a.sent();
|
|
192
|
+
return [4 /*yield*/, user.click(screen.getByTestId('download-button'))];
|
|
193
|
+
case 2:
|
|
194
|
+
_a.sent();
|
|
195
|
+
expect(downloadImagesByURLs).toHaveBeenCalledWith(['/test.jpg']);
|
|
196
|
+
return [4 /*yield*/, user.click(screen.getByTestId('image-overlay-actions'))];
|
|
197
|
+
case 3:
|
|
198
|
+
_a.sent();
|
|
199
|
+
return [4 /*yield*/, user.click(screen.getByText('Share link'))];
|
|
200
|
+
case 4:
|
|
201
|
+
_a.sent();
|
|
202
|
+
return [4 /*yield*/, navigator.clipboard.readText()];
|
|
203
|
+
case 5:
|
|
204
|
+
clipboardText = _a.sent();
|
|
205
|
+
expect(clipboardText).toBe('/test.jpg');
|
|
206
|
+
return [4 /*yield*/, user.click(screen.getByTestId('image-overlay-actions'))];
|
|
207
|
+
case 6:
|
|
208
|
+
_a.sent();
|
|
209
|
+
return [4 /*yield*/, user.click(screen.getByText('Set as default'))];
|
|
210
|
+
case 7:
|
|
211
|
+
_a.sent();
|
|
212
|
+
expect(insertDefaultImageByAttrUri).toHaveBeenCalledWith('entities/1Rd2I9Mt', imageAttributeValues[0].uri);
|
|
213
|
+
expect(defaultMdmActions.setDefaultProfilePicForEntity).toHaveBeenCalledWith(imageAttributeValues[0]);
|
|
214
|
+
return [4 /*yield*/, user.click(screen.getByTestId('image-overlay-actions'))];
|
|
215
|
+
case 8:
|
|
216
|
+
_a.sent();
|
|
217
|
+
return [4 /*yield*/, user.click(screen.getByText('Delete'))];
|
|
218
|
+
case 9:
|
|
219
|
+
_a.sent();
|
|
220
|
+
expect(onDeleteAttribute).toHaveBeenCalledWith({
|
|
221
|
+
uri: imageAttributeValues[0].uri,
|
|
222
|
+
attributeType: defaultProps.attributeType
|
|
223
|
+
});
|
|
224
|
+
return [2 /*return*/];
|
|
225
|
+
}
|
|
218
226
|
});
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
}); });
|
|
228
|
+
it('should open and close UploadImageDialog by clicking on .uploadContainer', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
229
|
+
var user, backdrop;
|
|
230
|
+
return __generator(this, function (_a) {
|
|
231
|
+
switch (_a.label) {
|
|
232
|
+
case 0:
|
|
233
|
+
user = setUp().user;
|
|
234
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
235
|
+
return [4 /*yield*/, user.click(screen.getByTestId('reltio-upload-image-button'))];
|
|
236
|
+
case 1:
|
|
237
|
+
_a.sent();
|
|
238
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
239
|
+
expect(screen.getByText('Add new image')).toBeInTheDocument();
|
|
240
|
+
backdrop = screen.getAllByRole('presentation')[0].firstChild;
|
|
241
|
+
return [4 /*yield*/, user.click(backdrop)];
|
|
242
|
+
case 2:
|
|
243
|
+
_a.sent();
|
|
244
|
+
return [4 /*yield*/, waitForElementToBeRemoved(screen.queryByRole('dialog'))];
|
|
245
|
+
case 3:
|
|
246
|
+
_a.sent();
|
|
247
|
+
return [2 /*return*/];
|
|
248
|
+
}
|
|
231
249
|
});
|
|
232
|
-
|
|
233
|
-
});
|
|
250
|
+
}); });
|
|
234
251
|
describe('onChangeAttribute test', function () {
|
|
235
|
-
it('should add images to globalState with imageProps', function () {
|
|
236
|
-
var
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
252
|
+
it('should add images to globalState with imageProps', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
253
|
+
var user, uploadImageDialog;
|
|
254
|
+
return __generator(this, function (_a) {
|
|
255
|
+
switch (_a.label) {
|
|
256
|
+
case 0:
|
|
257
|
+
uploadImage.mockResolvedValue({
|
|
258
|
+
Url: 'https://s3.amazonaws.com/reltio.qa.ih/sourcenew/hc3IZh8C1ixGWpmRPr54HufUd.png',
|
|
259
|
+
UrlThumbnail: 'https://s3.amazonaws.com/reltio.qa.ih/thumbnailInew/oLd1Fs5Sh2SVHHHV7uyHFZhsi.png',
|
|
260
|
+
CdnUrlThumbnail: 'https://s3.amazonaws.com/reltio.qa.ih/thumbnailInew/oLd1Fs5Sh2SVHHHV7uyHFZhsi.png',
|
|
261
|
+
Width: '990',
|
|
262
|
+
Height: '946',
|
|
263
|
+
Size: '114373',
|
|
264
|
+
MimeType: 'image/png',
|
|
265
|
+
CreationTimestamp: 1734017226633
|
|
266
|
+
});
|
|
267
|
+
user = setUp().user;
|
|
268
|
+
return [4 /*yield*/, user.click(screen.getByTestId('reltio-upload-image-button'))];
|
|
269
|
+
case 1:
|
|
270
|
+
_a.sent();
|
|
271
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
272
|
+
uploadImageDialog = screen.getByTestId('upload-image-button');
|
|
273
|
+
expect(uploadImageDialog).toBeInTheDocument();
|
|
274
|
+
return [4 /*yield*/, user.upload(uploadImageDialog, new File(['test'], 'test.png', { type: 'image/png' }))];
|
|
275
|
+
case 2:
|
|
276
|
+
_a.sent();
|
|
277
|
+
expect(onChangeAttribute).toHaveBeenCalledWith({
|
|
278
|
+
attributeType: attributeType,
|
|
279
|
+
uri: expect.any(String),
|
|
280
|
+
value: {
|
|
281
|
+
CdnUrlThumbnail: [
|
|
282
|
+
{
|
|
283
|
+
ov: true,
|
|
284
|
+
type: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/CdnUrlThumbnail',
|
|
285
|
+
uri: expect.any(String),
|
|
286
|
+
value: 'https://s3.amazonaws.com/reltio.qa.ih/thumbnailInew/oLd1Fs5Sh2SVHHHV7uyHFZhsi.png'
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
Url: [
|
|
290
|
+
{
|
|
291
|
+
ov: true,
|
|
292
|
+
type: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/Url',
|
|
293
|
+
uri: expect.any(String),
|
|
294
|
+
value: 'https://s3.amazonaws.com/reltio.qa.ih/sourcenew/hc3IZh8C1ixGWpmRPr54HufUd.png'
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
UrlThumbnail: [
|
|
298
|
+
{
|
|
299
|
+
ov: true,
|
|
300
|
+
type: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/UrlThumbnail',
|
|
301
|
+
uri: expect.any(String),
|
|
302
|
+
value: 'https://s3.amazonaws.com/reltio.qa.ih/thumbnailInew/oLd1Fs5Sh2SVHHHV7uyHFZhsi.png'
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return [4 /*yield*/, waitForElementToBeRemoved(screen.queryByRole('dialog'))];
|
|
308
|
+
case 3:
|
|
309
|
+
_a.sent();
|
|
310
|
+
return [2 /*return*/];
|
|
289
311
|
}
|
|
290
312
|
});
|
|
291
|
-
});
|
|
292
|
-
it('should add images to globalState without imageProps', function () {
|
|
293
|
-
var component = setUp();
|
|
294
|
-
var uploadImageDialog = component.find(UploadImageDialog);
|
|
295
|
-
uploadImageDialog.prop('onUpload')({});
|
|
296
|
-
expect(onChangeAttribute).toHaveBeenCalledWith({
|
|
297
|
-
attributeType: defaultProps.attributeType,
|
|
298
|
-
uri: '1/ImageGallery',
|
|
299
|
-
value: {}
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
it('should add images to globalState with unknown keys in imageProps', function () {
|
|
303
|
-
var component = setUp();
|
|
304
|
-
var uploadImageDialog = component.find(UploadImageDialog);
|
|
305
|
-
uploadImageDialog.prop('onUpload')({
|
|
306
|
-
Height: '5',
|
|
307
|
-
MimeType: '6',
|
|
308
|
-
Size: '7'
|
|
309
|
-
});
|
|
310
|
-
expect(onChangeAttribute).toHaveBeenCalledWith({
|
|
311
|
-
attributeType: defaultProps.attributeType,
|
|
312
|
-
uri: '1/ImageGallery',
|
|
313
|
-
value: {}
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
it('should add images to globalState without attributes in attributeType', function () {
|
|
317
|
-
var props = __assign(__assign({}, defaultProps), { attributeType: __assign(__assign({}, defaultProps.attributeType), { attributes: undefined }) });
|
|
318
|
-
var component = setUp({ props: props });
|
|
319
|
-
var uploadImageDialog = component.find(UploadImageDialog);
|
|
320
|
-
uploadImageDialog.prop('onUpload')({
|
|
321
|
-
Height: '5',
|
|
322
|
-
MimeType: '6',
|
|
323
|
-
Size: '7'
|
|
324
|
-
});
|
|
325
|
-
expect(onChangeAttribute).toHaveBeenCalledWith({
|
|
326
|
-
attributeType: __assign(__assign({}, defaultProps.attributeType), { attributes: undefined }),
|
|
327
|
-
uri: '1/ImageGallery',
|
|
328
|
-
value: {}
|
|
329
|
-
});
|
|
330
|
-
});
|
|
313
|
+
}); });
|
|
331
314
|
});
|
|
332
315
|
describe('handleDeleteAttribute test', function () {
|
|
333
|
-
it('should delete and choose another defaultPic', function () {
|
|
334
|
-
var
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
316
|
+
it('should delete and choose another defaultPic', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
317
|
+
var user, container;
|
|
318
|
+
return __generator(this, function (_a) {
|
|
319
|
+
switch (_a.label) {
|
|
320
|
+
case 0:
|
|
321
|
+
user = setUp({ props: { attributeValues: imageAttributeValues, overlay: true } }).user;
|
|
322
|
+
container = screen.getByTestId('image-line-edit-mode');
|
|
323
|
+
resizeObserver.mockElementSize(container, { contentBoxSize: { inlineSize: 600 } });
|
|
324
|
+
act(function () {
|
|
325
|
+
resizeObserver.resize();
|
|
326
|
+
});
|
|
327
|
+
fireEvent.load(screen.getAllByRole('img', { hidden: true })[0]);
|
|
328
|
+
return [4 /*yield*/, user.hover(screen.getByTestId('image-actions-overlay'))];
|
|
329
|
+
case 1:
|
|
330
|
+
_a.sent();
|
|
331
|
+
return [4 /*yield*/, user.click(screen.getByTestId('image-overlay-actions'))];
|
|
332
|
+
case 2:
|
|
333
|
+
_a.sent();
|
|
334
|
+
return [4 /*yield*/, user.click(screen.getByText('Delete'))];
|
|
335
|
+
case 3:
|
|
336
|
+
_a.sent();
|
|
337
|
+
expect(defaultMdmActions.setDefaultProfilePicForModifiedEntity).toHaveBeenCalledWith({
|
|
338
|
+
entityUri: 'entities/1Rd2I9Mt',
|
|
339
|
+
value: imageAttributeValues[1]
|
|
340
|
+
});
|
|
341
|
+
expect(onDeleteAttribute).toHaveBeenCalledWith({
|
|
342
|
+
uri: imageAttributeValues[0].uri,
|
|
343
|
+
attributeType: defaultProps.attributeType
|
|
344
|
+
});
|
|
345
|
+
return [2 /*return*/];
|
|
346
|
+
}
|
|
347
347
|
});
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
348
|
+
}); });
|
|
349
|
+
it('should not choose another defaultPic if non-default deleted', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
350
|
+
var user, container;
|
|
351
|
+
return __generator(this, function (_a) {
|
|
352
|
+
switch (_a.label) {
|
|
353
|
+
case 0:
|
|
354
|
+
user = setUp({ props: { attributeValues: imageAttributeValues, overlay: true } }).user;
|
|
355
|
+
container = screen.getByTestId('image-line-edit-mode');
|
|
356
|
+
resizeObserver.mockElementSize(container, { contentBoxSize: { inlineSize: 600 } });
|
|
357
|
+
act(function () {
|
|
358
|
+
resizeObserver.resize();
|
|
359
|
+
});
|
|
360
|
+
fireEvent.load(screen.getAllByRole('img', { hidden: true })[1]);
|
|
361
|
+
return [4 /*yield*/, user.hover(screen.getByTestId('image-actions-overlay'))];
|
|
362
|
+
case 1:
|
|
363
|
+
_a.sent();
|
|
364
|
+
return [4 /*yield*/, user.click(screen.getByTestId('image-overlay-actions'))];
|
|
365
|
+
case 2:
|
|
366
|
+
_a.sent();
|
|
367
|
+
return [4 /*yield*/, user.click(screen.getByText('Delete'))];
|
|
368
|
+
case 3:
|
|
369
|
+
_a.sent();
|
|
370
|
+
expect(defaultMdmActions.setDefaultProfilePicForModifiedEntity).not.toHaveBeenCalled();
|
|
371
|
+
expect(onDeleteAttribute).toHaveBeenCalledWith({
|
|
372
|
+
uri: imageAttributeValues[1].uri,
|
|
373
|
+
attributeType: defaultProps.attributeType
|
|
374
|
+
});
|
|
375
|
+
return [2 /*return*/];
|
|
376
|
+
}
|
|
359
377
|
});
|
|
360
|
-
|
|
361
|
-
});
|
|
378
|
+
}); });
|
|
362
379
|
});
|
|
363
380
|
});
|