@reltio/components 1.4.2051 → 1.4.2053
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 +2 -2
- 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
|
@@ -6,7 +6,7 @@ export declare const RecommendedIconWithTooltip: React.ForwardRefExoticComponent
|
|
|
6
6
|
tooltipPlacement?: import("@mui/material").TooltipProps["placement"];
|
|
7
7
|
showForDisabled?: boolean;
|
|
8
8
|
} & React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
9
|
-
type Data = {
|
|
9
|
+
type Data = Record<string, unknown> & {
|
|
10
10
|
attrType?: AttributeType;
|
|
11
11
|
};
|
|
12
12
|
type Props = {
|
|
@@ -9,11 +9,11 @@ export var ChartTooltip = function (_a) {
|
|
|
9
9
|
var localizedValue = (tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.localizedValue) || (tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.value);
|
|
10
10
|
var tooltipLabel = tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.label;
|
|
11
11
|
var percent = tooltipPayload === null || tooltipPayload === void 0 ? void 0 : tooltipPayload.percent;
|
|
12
|
-
return (active && (React.createElement("div", { className: styles.tooltipWrapper },
|
|
12
|
+
return (active && (React.createElement("div", { "data-reltio-id": "chart-tooltip", className: styles.tooltipWrapper },
|
|
13
13
|
React.createElement("p", { className: styles.tooltipTitle }, tooltipLabel),
|
|
14
|
-
isNil(percent) ? (React.createElement("p", { className: styles.tooltipValue },
|
|
14
|
+
isNil(percent) ? (React.createElement("p", { "data-reltio-id": "chart-tooltip-value", className: styles.tooltipValue },
|
|
15
15
|
"Value: ",
|
|
16
|
-
localizedValue)) : (React.createElement("p", { className: styles.tooltipValueBold },
|
|
16
|
+
localizedValue)) : (React.createElement("p", { "data-reltio-id": "chart-tooltip-value", className: styles.tooltipValueBold },
|
|
17
17
|
localizedValue,
|
|
18
18
|
React.createElement("span", { className: styles.tooltipPercent },
|
|
19
19
|
" (",
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
export function ColumnListItem({ item, onClick, checked, level, style, isFocused, isGroupItem, hideCheckBox }: {
|
|
2
|
-
item: any;
|
|
3
|
-
onClick: any;
|
|
4
|
-
checked: any;
|
|
5
|
-
level: any;
|
|
6
|
-
style: any;
|
|
7
|
-
isFocused: any;
|
|
8
|
-
isGroupItem: any;
|
|
9
|
-
hideCheckBox: any;
|
|
10
|
-
}): React.JSX.Element;
|
|
11
|
-
export namespace ColumnListItem {
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
let item: PropTypes.Requireable<PropTypes.InferProps<{
|
|
14
|
-
label: PropTypes.Requireable<string>;
|
|
15
|
-
filterText: PropTypes.Requireable<string>;
|
|
16
|
-
}>>;
|
|
17
|
-
let level: PropTypes.Requireable<number>;
|
|
18
|
-
let onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
let checked: PropTypes.Requireable<boolean>;
|
|
20
|
-
let style: PropTypes.Requireable<object>;
|
|
21
|
-
let isGroupItem: PropTypes.Requireable<boolean>;
|
|
22
|
-
let isFocused: PropTypes.Requireable<boolean>;
|
|
23
|
-
let hideCheckBox: PropTypes.Requireable<boolean>;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
1
|
import React from 'react';
|
|
27
|
-
import
|
|
2
|
+
import { AttributeListItem } from '../../../AttributeListItem';
|
|
3
|
+
type Props = Pick<React.ComponentProps<typeof AttributeListItem>, 'hideCheckBox' | 'onClick' | 'checked' | 'level' | 'style' | 'isFocused'> & {
|
|
4
|
+
item: {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
filterText?: string;
|
|
8
|
+
};
|
|
9
|
+
isGroupItem?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const ColumnListItem: ({ item, onClick, checked, level, style, isFocused, isGroupItem, hideCheckBox }: Props) => React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classnames from 'classnames';
|
|
4
3
|
import { AttributeListItem } from '../../../AttributeListItem';
|
|
5
4
|
import { Highlighter } from '../../../Highlighter';
|
|
@@ -10,16 +9,3 @@ export var ColumnListItem = function (_a) {
|
|
|
10
9
|
var styles = useStyles();
|
|
11
10
|
return (React.createElement(AttributeListItem, { hideCheckBox: hideCheckBox, key: item.id, onClick: onClick, checked: checked, level: level, data: item, label: React.createElement(Highlighter, { text: item.label, highlight: item.filterText }), labelInText: item.label, style: style, isFocused: isFocused, hideIcon: isGroupItem, className: classnames((_b = {}, _b[styles.groupItem] = isGroupItem, _b)) }));
|
|
12
11
|
};
|
|
13
|
-
ColumnListItem.propTypes = {
|
|
14
|
-
item: PropTypes.shape({
|
|
15
|
-
label: PropTypes.string,
|
|
16
|
-
filterText: PropTypes.string
|
|
17
|
-
}),
|
|
18
|
-
level: PropTypes.number,
|
|
19
|
-
onClick: PropTypes.func,
|
|
20
|
-
checked: PropTypes.bool,
|
|
21
|
-
style: PropTypes.object,
|
|
22
|
-
isGroupItem: PropTypes.bool,
|
|
23
|
-
isFocused: PropTypes.bool,
|
|
24
|
-
hideCheckBox: PropTypes.bool
|
|
25
|
-
};
|
|
@@ -40,7 +40,7 @@ export function DropDownMenuButton(_a) {
|
|
|
40
40
|
return React.createElement(MenuItemRenderer, { item: item, key: index, onMenuClose: handleToggle });
|
|
41
41
|
};
|
|
42
42
|
return (React.createElement(React.Fragment, null,
|
|
43
|
-
React.createElement(ButtonComponent, __assign({ "data-reltio-id":
|
|
43
|
+
React.createElement(ButtonComponent, __assign({ "data-reltio-id": "drop-down-menu-button", ref: buttonRef, className: classnames(styles.buttonRoot, (_b = {},
|
|
44
44
|
_b[styles.selected] = isOpen,
|
|
45
45
|
_b), className), onClick: handleToggle, "aria-pressed": isOpen, "aria-controls": isOpen ? menuId : undefined, "aria-haspopup": "true" }, buttonProps), buttonContent),
|
|
46
46
|
React.createElement(Menu, __assign({ id: menuId, variant: "menu", open: isOpen, autoFocus: false, classes: { paper: styles.paper }, anchorEl: buttonRef.current, onClose: handleToggle, anchorOrigin: {
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
13
|
+
import { render, screen, act } from '@testing-library/react';
|
|
4
14
|
import { AsyncMountContext } from '../../contexts/AsyncMountContext';
|
|
5
15
|
import { withAsyncMount } from './withAsyncMount';
|
|
6
16
|
describe('withAsyncMount tests', function () {
|
|
7
17
|
beforeAll(function () {
|
|
8
18
|
jest.useFakeTimers();
|
|
9
19
|
});
|
|
20
|
+
var defaultContextValue = { enabled: true, queueSizeThreshold: 0 };
|
|
10
21
|
var Component = function (_a) {
|
|
11
22
|
var value = _a.value;
|
|
12
|
-
return React.createElement("div", { "data-id": value });
|
|
13
|
-
};
|
|
23
|
+
return React.createElement("div", { "data-reltio-id": value });
|
|
24
|
+
};
|
|
25
|
+
var Placeholder = function () { return React.createElement("span", { "data-reltio-id": "placeholder" }); };
|
|
26
|
+
var setUp = function (_a) {
|
|
27
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.contextValue, contextValue = _c === void 0 ? {} : _c, _d = _b.withProvider, withProvider = _d === void 0 ? true : _d, _e = _b.withPlaceholder, withPlaceholder = _e === void 0 ? false : _e;
|
|
28
|
+
var Providers = function (_a) {
|
|
29
|
+
var children = _a.children;
|
|
30
|
+
return (React.createElement(AsyncMountContext.Provider, { value: __assign(__assign({}, defaultContextValue), contextValue) }, children));
|
|
31
|
+
};
|
|
32
|
+
var AsyncMountedComponent = withAsyncMount(Component, withPlaceholder ? Placeholder : undefined);
|
|
33
|
+
return render(React.createElement(AsyncMountedComponent, { value: "test-value" }), { wrapper: withProvider ? Providers : undefined });
|
|
34
|
+
};
|
|
14
35
|
it('should mount wrapped component in sync way without AsyncMountContext.Provider', function () {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
expect(component.find(Component).exists()).toBe(true);
|
|
36
|
+
setUp({ withProvider: false });
|
|
37
|
+
expect(screen.getByTestId('test-value')).toBeInTheDocument();
|
|
18
38
|
});
|
|
19
39
|
it('should mount wrapped component in sync way with AsyncMountContext.Provider if value.enabled = false', function () {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
React.createElement(AsyncMountedComponent, { value: "123" })));
|
|
23
|
-
expect(component.find(Component).exists()).toBe(true);
|
|
40
|
+
setUp({ contextValue: { enabled: false } });
|
|
41
|
+
expect(screen.getByTestId('test-value')).toBeInTheDocument();
|
|
24
42
|
});
|
|
25
43
|
it('should mount wrapped component in async way with AsyncMountContext.Provider if value.enabled = true', function () {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
React.createElement(AsyncMountedComponent, { value: "123" })));
|
|
29
|
-
expect(component.find(Component).exists()).toBe(false);
|
|
30
|
-
expect(component.isEmptyRender()).toBe(true);
|
|
44
|
+
setUp({ contextValue: { enabled: true } });
|
|
45
|
+
expect(screen.queryByTestId('test-value')).not.toBeInTheDocument();
|
|
31
46
|
act(function () {
|
|
32
47
|
jest.runOnlyPendingTimers();
|
|
33
48
|
});
|
|
34
|
-
|
|
35
|
-
expect(component.find(Component).exists()).toBe(true);
|
|
36
|
-
expect(component.find(Component).prop('value')).toBe('123');
|
|
37
|
-
expect(component.isEmptyRender()).toBe(false);
|
|
49
|
+
expect(screen.getByTestId('test-value')).toBeInTheDocument();
|
|
38
50
|
});
|
|
39
51
|
it('should render PlaceholderComponent instead of Component before mounting if its passed as second argument', function () {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
React.createElement(AsyncMountedComponent, { value: "123" })));
|
|
44
|
-
expect(component.find(Component).exists()).toBe(false);
|
|
45
|
-
expect(component.find(Placeholder).exists()).toBe(true);
|
|
52
|
+
setUp({ withPlaceholder: true });
|
|
53
|
+
expect(screen.queryByTestId('test-value')).not.toBeInTheDocument();
|
|
54
|
+
expect(screen.getByTestId('placeholder')).toBeInTheDocument();
|
|
46
55
|
act(function () {
|
|
47
56
|
jest.runOnlyPendingTimers();
|
|
48
57
|
});
|
|
49
|
-
|
|
50
|
-
expect(
|
|
51
|
-
expect(component.find(Component).prop('value')).toBe('123');
|
|
52
|
-
expect(component.find(Placeholder).exists()).toBe(false);
|
|
58
|
+
expect(screen.getByTestId('test-value')).toBeInTheDocument();
|
|
59
|
+
expect(screen.queryByTestId('placeholder')).not.toBeInTheDocument();
|
|
53
60
|
});
|
|
54
61
|
describe('queueSizeThreshold behavior', function () {
|
|
55
62
|
it('should not use context value.queueSizeThreshold by default', function () {
|
|
56
63
|
var AsyncMountedComponent = withAsyncMount(Component);
|
|
57
|
-
|
|
58
|
-
React.createElement(AsyncMountedComponent, { value: "
|
|
59
|
-
React.createElement(AsyncMountedComponent, { value: "
|
|
60
|
-
expect(
|
|
64
|
+
render(React.createElement(AsyncMountContext.Provider, { value: { enabled: true, queueSizeThreshold: 0 } },
|
|
65
|
+
React.createElement(AsyncMountedComponent, { value: "test-value" }),
|
|
66
|
+
React.createElement(AsyncMountedComponent, { value: "test-value" })));
|
|
67
|
+
expect(screen.queryAllByTestId('test-value').length).toBe(0);
|
|
61
68
|
act(function () {
|
|
62
69
|
jest.runOnlyPendingTimers();
|
|
63
70
|
});
|
|
64
|
-
|
|
65
|
-
expect(component.find(Component).length).toBe(2);
|
|
71
|
+
expect(screen.queryAllByTestId('test-value').length).toBe(2);
|
|
66
72
|
});
|
|
67
73
|
it('should use async mount only after exceeding of "value.queueSizeThreshold" number of component mounts', function () {
|
|
68
74
|
var AsyncMountedComponent = withAsyncMount(Component);
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
React.createElement(
|
|
72
|
-
|
|
75
|
+
var Providers = function (_a) {
|
|
76
|
+
var children = _a.children;
|
|
77
|
+
return (React.createElement(AsyncMountContext.Provider, { value: { enabled: true, queueSizeThreshold: 2 } }, children));
|
|
78
|
+
};
|
|
79
|
+
render(React.createElement(React.Fragment, null,
|
|
80
|
+
React.createElement(AsyncMountedComponent, { value: "test-value" }),
|
|
81
|
+
React.createElement(AsyncMountedComponent, { value: "test-value" }),
|
|
82
|
+
React.createElement(AsyncMountedComponent, { value: "test-value" })), { wrapper: Providers });
|
|
83
|
+
expect(screen.queryAllByTestId('test-value').length).toBe(2);
|
|
73
84
|
act(function () {
|
|
74
85
|
jest.runOnlyPendingTimers();
|
|
75
86
|
});
|
|
76
|
-
|
|
77
|
-
expect(component.find(Component).length).toBe(2);
|
|
78
|
-
component = mount(React.createElement(AsyncMountContext.Provider, { value: { enabled: true, queueSizeThreshold: 2 } },
|
|
79
|
-
React.createElement(AsyncMountedComponent, { value: "123" }),
|
|
80
|
-
React.createElement(AsyncMountedComponent, { value: "123" }),
|
|
81
|
-
React.createElement(AsyncMountedComponent, { value: "123" })));
|
|
82
|
-
expect(component.find(Component).length).toBe(2);
|
|
83
|
-
act(function () {
|
|
84
|
-
jest.runOnlyPendingTimers();
|
|
85
|
-
});
|
|
86
|
-
component.update();
|
|
87
|
-
expect(component.find(Component).length).toBe(3);
|
|
87
|
+
expect(screen.queryAllByTestId('test-value').length).toBe(3);
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
});
|
|
@@ -1,29 +1,118 @@
|
|
|
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 {
|
|
3
|
-
import
|
|
4
|
-
import IgnoredIcon from '../icons/Ignored';
|
|
5
|
-
import IgnoredOutlinedIcon from '../icons/IgnoredOutlined';
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
6
51
|
import { IgnoreButton } from './IgnoreButton';
|
|
7
52
|
describe('Ignore button test', function () {
|
|
8
|
-
var
|
|
9
|
-
var getButton = function (component) { return component.find(SmallIconButtonWithTooltip); };
|
|
53
|
+
var onClickSpy = jest.fn();
|
|
10
54
|
beforeEach(function () {
|
|
11
|
-
|
|
12
|
-
component = mount(React.createElement(IgnoreButton, { isIgnored: false, onClick: onClickFn }));
|
|
13
|
-
});
|
|
14
|
-
it('should pass button props correctly', function () {
|
|
15
|
-
expect(getButton(component).prop('onClick')).toBe(onClickFn);
|
|
16
|
-
component.setProps({ disabled: true });
|
|
17
|
-
expect(getButton(component).prop('disabled')).toBe(true);
|
|
55
|
+
jest.clearAllMocks();
|
|
18
56
|
});
|
|
57
|
+
var setUp = function (props) {
|
|
58
|
+
if (props === void 0) { props = {}; }
|
|
59
|
+
var user = userEvent.setup();
|
|
60
|
+
render(React.createElement(IgnoreButton, __assign({ isIgnored: false, onClick: onClickSpy }, props)));
|
|
61
|
+
return { user: user };
|
|
62
|
+
};
|
|
63
|
+
it('should pass button props correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
64
|
+
var user, button;
|
|
65
|
+
return __generator(this, function (_a) {
|
|
66
|
+
switch (_a.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
user = setUp().user;
|
|
69
|
+
button = screen.getByRole('button');
|
|
70
|
+
expect(button).toBeEnabled();
|
|
71
|
+
return [4 /*yield*/, user.click(button)];
|
|
72
|
+
case 1:
|
|
73
|
+
_a.sent();
|
|
74
|
+
expect(onClickSpy).toHaveBeenCalledTimes(1);
|
|
75
|
+
return [2 /*return*/];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}); });
|
|
19
79
|
it('should show correct icon', function () {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
expect(getButton(component).prop('icon')).toBe(IgnoredIcon);
|
|
80
|
+
setUp();
|
|
81
|
+
expect(screen.getByTestId('SvgIgnoredOutlined')).toBeInTheDocument();
|
|
23
82
|
});
|
|
24
|
-
it('should show correct
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
expect(getButton(component).prop('tooltipTitle')).toBe("You don't have permissions to ignore");
|
|
83
|
+
it('should show correct icon when ignored', function () {
|
|
84
|
+
setUp({ isIgnored: true });
|
|
85
|
+
expect(screen.getByTestId('SvgIgnored')).toBeInTheDocument();
|
|
28
86
|
});
|
|
87
|
+
it('should show correct tooltip', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
+
var user, button;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
user = setUp().user;
|
|
93
|
+
button = screen.getByRole('button');
|
|
94
|
+
return [4 /*yield*/, user.hover(button)];
|
|
95
|
+
case 1:
|
|
96
|
+
_a.sent();
|
|
97
|
+
expect(screen.getByText('Ignore')).toBeInTheDocument();
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); });
|
|
102
|
+
it('should show correct tooltip when disabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
+
var user, button;
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
user = setUp({ disabled: true }).user;
|
|
108
|
+
button = screen.getByRole('button');
|
|
109
|
+
return [4 /*yield*/, user.hover(button)];
|
|
110
|
+
case 1:
|
|
111
|
+
_a.sent();
|
|
112
|
+
expect(button).toBeDisabled();
|
|
113
|
+
expect(screen.getByText("You don't have permissions to ignore")).toBeInTheDocument();
|
|
114
|
+
return [2 /*return*/];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}); });
|
|
29
118
|
});
|
package/Image/Image.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ type Props = {
|
|
|
8
8
|
overlay?: React.ReactNode;
|
|
9
9
|
onClick?: () => void;
|
|
10
10
|
};
|
|
11
|
-
declare const _default: React.MemoExoticComponent<(
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ src, className, containerClassName, size, overlay, ...otherProps }: Props) => React.JSX.Element>;
|
|
12
12
|
export default _default;
|
package/Image/Image.js
CHANGED
|
@@ -28,12 +28,12 @@ import { isEmptyValue } from '@reltio/mdm-sdk';
|
|
|
28
28
|
import { ImageSizesStyles } from './constants';
|
|
29
29
|
import { RequestStates } from '../types';
|
|
30
30
|
import { useStyles } from './styles';
|
|
31
|
-
var Image = function (
|
|
32
|
-
var
|
|
33
|
-
var src =
|
|
31
|
+
var Image = function (_a) {
|
|
32
|
+
var _b;
|
|
33
|
+
var src = _a.src, className = _a.className, containerClassName = _a.containerClassName, _c = _a.size, size = _c === void 0 ? ImageSizesStyles.SMALL : _c, _d = _a.overlay, overlay = _d === void 0 ? null : _d, otherProps = __rest(_a, ["src", "className", "containerClassName", "size", "overlay"]);
|
|
34
34
|
var sizeStyles = size || ImageSizesStyles.SMALL;
|
|
35
35
|
var styles = useStyles(sizeStyles);
|
|
36
|
-
var
|
|
36
|
+
var _e = useState(RequestStates.LOADING), imageLoadingState = _e[0], setImageLoadingState = _e[1];
|
|
37
37
|
useEffect(function () {
|
|
38
38
|
setImageLoadingState(RequestStates.LOADING);
|
|
39
39
|
}, [src]);
|
|
@@ -47,10 +47,10 @@ var Image = function (props) {
|
|
|
47
47
|
var imageIsLoaded = imageLoadingState === RequestStates.LOADED;
|
|
48
48
|
var imageLoadingError = imageLoadingState === RequestStates.ERROR;
|
|
49
49
|
return imageLoadingError ? (React.createElement("div", __assign({ className: classnames(styles.defaultContainer, styles.image, className) }, otherProps),
|
|
50
|
-
React.createElement(NotAvailableImage, { className: styles.defaultImage }))) : (React.createElement("div", { className: classnames(styles.root, containerClassName) },
|
|
51
|
-
!isEmptyValue(src) && (React.createElement("img", __assign({ src: src, className: classnames(styles.image, className, (
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
React.createElement(NotAvailableImage, { "data-reltio-id": "not-available-image", className: styles.defaultImage }))) : (React.createElement("div", { className: classnames(styles.root, containerClassName) },
|
|
51
|
+
!isEmptyValue(src) && (React.createElement("img", __assign({ src: src, className: classnames(styles.image, className, (_b = {},
|
|
52
|
+
_b[styles.hideImage] = imageIsLoading,
|
|
53
|
+
_b)), onLoad: onImageLoad, onError: onImageLoadFail, alt: 'image' }, otherProps))),
|
|
54
54
|
imageIsLoading && (React.createElement("div", __assign({ className: classnames(styles.defaultContainer, styles.image, className) }, otherProps),
|
|
55
55
|
React.createElement(DefaultImage, { className: styles.defaultImage }))),
|
|
56
56
|
imageIsLoaded && overlay));
|
package/Image/Image.test.js
CHANGED
|
@@ -1,65 +1,60 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { act } from 'react-dom/test-utils';
|
|
4
|
-
import DefaultImage from '../icons/DefaultImage';
|
|
5
|
-
import NotAvailableImage from '@mui/icons-material/BrokenImage';
|
|
6
|
-
import { rerenderWrapper } from '../test-utils';
|
|
13
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
7
14
|
import Image from './Image';
|
|
15
|
+
var setUp = function (props) {
|
|
16
|
+
if (props === void 0) { props = {}; }
|
|
17
|
+
return render(React.createElement(Image, __assign({ src: 'path' }, props)));
|
|
18
|
+
};
|
|
8
19
|
describe('Image tests', function () {
|
|
9
20
|
it('should render main parts', function () {
|
|
10
|
-
|
|
11
|
-
expect(
|
|
21
|
+
setUp();
|
|
22
|
+
expect(screen.getByRole('img')).toBeInTheDocument();
|
|
12
23
|
});
|
|
13
24
|
it('should render default image', function () {
|
|
14
|
-
|
|
15
|
-
expect(
|
|
16
|
-
expect(
|
|
17
|
-
expect(component.find(DefaultImage)).toHaveLength(1);
|
|
25
|
+
setUp({ src: '' });
|
|
26
|
+
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
27
|
+
expect(screen.getByTestId('SvgDefaultImage')).toBeInTheDocument();
|
|
18
28
|
});
|
|
19
29
|
it('should reset "default image" state after src prop changing', function () {
|
|
20
|
-
var
|
|
21
|
-
expect(
|
|
22
|
-
expect(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
expect(
|
|
29
|
-
expect(component.find('.defaultContainer')).toHaveLength(1);
|
|
30
|
-
expect(component.find(DefaultImage)).toHaveLength(1);
|
|
31
|
-
act(function () {
|
|
32
|
-
component.find('img').simulate('load');
|
|
33
|
-
});
|
|
34
|
-
rerenderWrapper(component);
|
|
35
|
-
expect(component.find('img')).toHaveLength(1);
|
|
36
|
-
expect(component.find('.defaultContainer')).toHaveLength(0);
|
|
30
|
+
var rerender = setUp({ src: '' }).rerender;
|
|
31
|
+
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
32
|
+
expect(screen.getByTestId('SvgDefaultImage')).toBeInTheDocument();
|
|
33
|
+
rerender(React.createElement(Image, { src: '123' }));
|
|
34
|
+
var image = screen.getByRole('img');
|
|
35
|
+
expect(image).toBeInTheDocument();
|
|
36
|
+
expect(image).toHaveClass('hideImage');
|
|
37
|
+
fireEvent.load(image);
|
|
38
|
+
expect(screen.queryByTestId('default-container')).not.toBeInTheDocument();
|
|
37
39
|
});
|
|
38
40
|
it('should reset "default image" state when image loading was unsuccessful', function () {
|
|
39
|
-
|
|
40
|
-
var image =
|
|
41
|
-
expect(image).
|
|
42
|
-
expect(image
|
|
43
|
-
expect(
|
|
44
|
-
expect(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
rerenderWrapper(component);
|
|
50
|
-
expect(component.find('img')).toHaveLength(0);
|
|
51
|
-
expect(component.find('.defaultContainer')).toHaveLength(1);
|
|
52
|
-
expect(component.find(NotAvailableImage)).toHaveLength(1);
|
|
53
|
-
expect(component.find(DefaultImage)).toHaveLength(0);
|
|
41
|
+
setUp({ src: '123' });
|
|
42
|
+
var image = screen.getByRole('img');
|
|
43
|
+
expect(image).toBeInTheDocument();
|
|
44
|
+
expect(image).toHaveClass('hideImage');
|
|
45
|
+
expect(screen.getByTestId('SvgDefaultImage')).toBeInTheDocument();
|
|
46
|
+
expect(screen.queryByTestId('not-available-image')).not.toBeInTheDocument();
|
|
47
|
+
fireEvent.error(image);
|
|
48
|
+
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
49
|
+
expect(screen.getByTestId('not-available-image')).toBeInTheDocument();
|
|
50
|
+
expect(screen.queryByTestId('SvgDefaultImage')).not.toBeInTheDocument();
|
|
54
51
|
});
|
|
55
52
|
it('should render overlay if image is loaded', function () {
|
|
56
|
-
var overlay = React.createElement("div", {
|
|
57
|
-
|
|
58
|
-
expect(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
rerenderWrapper(component);
|
|
63
|
-
expect(component.find('.overlay')).toHaveLength(1);
|
|
53
|
+
var overlay = React.createElement("div", { "data-reltio-id": "overlay" });
|
|
54
|
+
setUp({ src: '123', overlay: overlay });
|
|
55
|
+
expect(screen.queryByTestId('overlay')).not.toBeInTheDocument();
|
|
56
|
+
var image = screen.getByRole('img');
|
|
57
|
+
fireEvent.load(image);
|
|
58
|
+
expect(screen.getByTestId('overlay')).toBeInTheDocument();
|
|
64
59
|
});
|
|
65
60
|
});
|
|
@@ -48,8 +48,9 @@ var ImageActionsOverlay = function (props) {
|
|
|
48
48
|
_a)), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: selectionMode ? toggleSelected(selected) : handleClick, "data-reltio-id": "image-actions-overlay" },
|
|
49
49
|
showCheckBox && (React.createElement(CheckedIcon, { className: styles.checkedIcon, checked: selected, onClick: toggleSelected(selected) })),
|
|
50
50
|
showActions && (React.createElement("div", { className: styles.actions },
|
|
51
|
-
React.createElement(SmallIconButton, { onClick: onDownload, className: styles.actionButton, icon: DownloadIcon }),
|
|
51
|
+
React.createElement(SmallIconButton, { "data-reltio-id": "download-button", onClick: onDownload, className: styles.actionButton, icon: DownloadIcon }),
|
|
52
52
|
React.createElement(DropDownMenuButton, { menuId: "image-overlay-actions-".concat(id), buttonComponent: SmallIconButton, buttonProps: {
|
|
53
|
+
'data-reltio-id': 'image-overlay-actions',
|
|
53
54
|
icon: MoreVertIcon,
|
|
54
55
|
className: classnames(styles.actionButton, styles.dropDownMenuButton)
|
|
55
56
|
}, menuItems: menuItems }))),
|