@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
|
@@ -74,36 +74,65 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
74
74
|
};
|
|
75
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
76
|
var react_1 = __importDefault(require("react"));
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var MoreVert_1 = __importDefault(require("@mui/icons-material/MoreVert"));
|
|
80
|
-
var DataTypeValue_1 = require("../DataTypeValue");
|
|
81
|
-
var DropDownMenuButton_1 = require("../DropDownMenuButton");
|
|
82
|
-
var IgnoreButton_1 = require("../IgnoreButton");
|
|
83
|
-
var PinButton_1 = require("../PinButton");
|
|
77
|
+
var react_2 = require("@testing-library/react");
|
|
78
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
84
79
|
var InlineSimpleAttribute_1 = require("./InlineSimpleAttribute");
|
|
85
80
|
var crosswalksDisplay = __importStar(require("../contexts/CrosswalksDisplayContext"));
|
|
86
|
-
var InlineSimpleAttributeEditor_1 = require("../InlineSimpleAttributeEditor");
|
|
87
81
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
88
82
|
var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
89
|
-
jest.mock('
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { debounce: function (x) { return x; } })); });
|
|
84
|
+
var defaultProps = {
|
|
85
|
+
attributeValue: {
|
|
86
|
+
type: 'configuration/entityTypes/Franchise/attributes/String',
|
|
87
|
+
ov: true,
|
|
88
|
+
value: 'Test',
|
|
89
|
+
uri: 'entities/123/attributes/String/123'
|
|
90
|
+
},
|
|
91
|
+
attributeType: {
|
|
92
|
+
label: 'String',
|
|
93
|
+
access: ['CREATE', 'UPDATE', 'DELETE', 'READ'],
|
|
94
|
+
type: 'String',
|
|
95
|
+
name: 'String',
|
|
96
|
+
uri: 'configuration/entityTypes/Franchise/attributes/String'
|
|
97
|
+
},
|
|
98
|
+
crosswalk: {
|
|
99
|
+
uri: 'entities/10wb4hEF/crosswalks/1PPwRPuk.3h28qA5Qw',
|
|
100
|
+
type: 'configuration/sources/Reltio',
|
|
101
|
+
value: '1PPwRPuk',
|
|
102
|
+
attributes: ['123/attributes/String/123']
|
|
103
|
+
},
|
|
104
|
+
isEmpty: false,
|
|
105
|
+
onIgnore: jest.fn(),
|
|
106
|
+
onEdit: jest.fn(),
|
|
107
|
+
onPin: jest.fn(),
|
|
108
|
+
onDelete: jest.fn()
|
|
109
|
+
};
|
|
110
|
+
var metadata = {
|
|
111
|
+
entityTypes: [],
|
|
112
|
+
sources: []
|
|
113
|
+
};
|
|
114
|
+
var setUp = function (props, skipHover) {
|
|
115
|
+
if (props === void 0) { props = {}; }
|
|
116
|
+
if (skipHover === void 0) { skipHover = false; }
|
|
117
|
+
var user = user_event_1.default.setup({ skipHover: skipHover });
|
|
118
|
+
var Providers = function (_a) {
|
|
119
|
+
var children = _a.children;
|
|
120
|
+
return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: { metadata: metadata } }, children));
|
|
97
121
|
};
|
|
98
|
-
return (0,
|
|
122
|
+
return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(InlineSimpleAttribute_1.InlineSimpleAttribute, __assign({}, defaultProps, props)), { wrapper: Providers }));
|
|
99
123
|
};
|
|
100
124
|
describe('Inline simple attribute tests', function () {
|
|
101
|
-
var actions, value, attributeType;
|
|
102
125
|
var color = '#ff00ff';
|
|
103
126
|
var highlightCrosswalk = jest.fn();
|
|
104
127
|
var removeHighlight = jest.fn();
|
|
105
|
-
|
|
128
|
+
var toggleCrosswalkFocus = jest.fn();
|
|
129
|
+
beforeEach(function () {
|
|
130
|
+
jest.clearAllMocks();
|
|
106
131
|
jest.spyOn(crosswalksDisplay, 'useCrosswalkColor').mockReturnValue(color);
|
|
132
|
+
jest.spyOn(crosswalksDisplay, 'useCrosswalkFocus').mockReturnValue({
|
|
133
|
+
isFocused: false,
|
|
134
|
+
toggleCrosswalkFocus: toggleCrosswalkFocus
|
|
135
|
+
});
|
|
107
136
|
jest.spyOn(crosswalksDisplay, 'useCrosswalkHighlight').mockReturnValue({
|
|
108
137
|
isHighlighted: true,
|
|
109
138
|
isDimmed: true,
|
|
@@ -111,372 +140,349 @@ describe('Inline simple attribute tests', function () {
|
|
|
111
140
|
removeHighlight: removeHighlight
|
|
112
141
|
});
|
|
113
142
|
});
|
|
114
|
-
beforeEach(function () {
|
|
115
|
-
actions = {
|
|
116
|
-
onIgnore: jest.fn(),
|
|
117
|
-
onEdit: jest.fn(),
|
|
118
|
-
onPin: jest.fn(),
|
|
119
|
-
onDelete: jest.fn()
|
|
120
|
-
};
|
|
121
|
-
value = {
|
|
122
|
-
type: 'configuration/entityTypes/Franchise/attributes/String',
|
|
123
|
-
ov: true,
|
|
124
|
-
value: 'Test',
|
|
125
|
-
uri: 'entities/123/attributes/String/123'
|
|
126
|
-
};
|
|
127
|
-
attributeType = {
|
|
128
|
-
label: 'String',
|
|
129
|
-
access: ['CREATE', 'UPDATE', 'DELETE', 'READ'],
|
|
130
|
-
type: 'String',
|
|
131
|
-
name: 'String',
|
|
132
|
-
uri: 'configuration/entityTypes/Franchise/attributes/String'
|
|
133
|
-
};
|
|
134
|
-
mdm_sdk_1.isCrosswalkDisabled.mockReturnValue(false);
|
|
135
|
-
});
|
|
136
|
-
var crosswalk = {
|
|
137
|
-
uri: 'entities/10wb4hEF/crosswalks/1PPwRPuk.3h28qA5Qw',
|
|
138
|
-
type: 'configuration/sources/Reltio',
|
|
139
|
-
value: '1PPwRPuk',
|
|
140
|
-
createDate: '2021-05-14T05:21:14.532Z',
|
|
141
|
-
updateDate: '2021-05-14T05:21:14.532Z',
|
|
142
|
-
reltioLoadDate: '2019-07-24T06:18:18.041Z',
|
|
143
|
-
singleAttributeUpdateDates: {
|
|
144
|
-
'123/attributes/String/123': '2021-07-08T07:09:14.781Z'
|
|
145
|
-
},
|
|
146
|
-
attributes: ['123/attributes/String/123']
|
|
147
|
-
};
|
|
148
143
|
it('should render attribute and hide actions', function () {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
expect(
|
|
152
|
-
expect(
|
|
153
|
-
expect(
|
|
154
|
-
expect(
|
|
155
|
-
expect(crosswalksDisplay.useCrosswalkColor).toHaveBeenCalledWith(crosswalk);
|
|
156
|
-
expect(
|
|
157
|
-
});
|
|
158
|
-
it('should render actions on hover', function () {
|
|
159
|
-
var props = __assign({ attributeValue: value, attributeType: attributeType, crosswalk: crosswalk, className: 'simpleAttribute' }, actions);
|
|
160
|
-
var wrapper = setUp(props);
|
|
161
|
-
(0, test_utils_1.act)(function () {
|
|
162
|
-
wrapper.find('.root').simulate('mouseenter');
|
|
163
|
-
});
|
|
164
|
-
wrapper.update();
|
|
165
|
-
expect(wrapper.find(DataTypeValue_1.DataTypeValue).prop('value')).toBe('Test');
|
|
166
|
-
expect(wrapper.find(PinButton_1.PinButton).length).toBe(1);
|
|
167
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).length).toBe(1);
|
|
168
|
-
expect(wrapper.find(DropDownMenuButton_1.DropDownMenuButton).prop('buttonProps')).toMatchObject({
|
|
169
|
-
icon: MoreVert_1.default,
|
|
170
|
-
tooltipTitle: 'More actions'
|
|
171
|
-
});
|
|
172
|
-
expect(highlightCrosswalk).toHaveBeenCalledTimes(1);
|
|
144
|
+
setUp();
|
|
145
|
+
expect(react_2.screen.getByText('Test')).toBeInTheDocument();
|
|
146
|
+
expect(react_2.screen.queryByLabelText('Pin')).not.toBeInTheDocument();
|
|
147
|
+
expect(react_2.screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
|
|
148
|
+
expect(react_2.screen.queryByLabelText('More actions')).not.toBeInTheDocument();
|
|
149
|
+
expect(react_2.screen.queryByTestId('masking-switcher')).not.toBeInTheDocument();
|
|
150
|
+
expect(crosswalksDisplay.useCrosswalkColor).toHaveBeenCalledWith(defaultProps.crosswalk);
|
|
151
|
+
expect(react_2.screen.queryByTestId('inline-simple-attribute-editor')).not.toBeInTheDocument();
|
|
173
152
|
});
|
|
174
|
-
it('should
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
153
|
+
it('should render actions on hover', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var user;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
user = setUp().user;
|
|
159
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
160
|
+
case 1:
|
|
161
|
+
_a.sent();
|
|
162
|
+
expect(react_2.screen.getByText('Test')).toBeInTheDocument();
|
|
163
|
+
expect(react_2.screen.getByLabelText('Pin')).toBeInTheDocument();
|
|
164
|
+
expect(react_2.screen.getByTestId('SvgPinOutlined')).toBeInTheDocument();
|
|
165
|
+
expect(react_2.screen.getByLabelText('Ignore')).toBeInTheDocument();
|
|
166
|
+
expect(react_2.screen.getByTestId('SvgIgnoredOutlined')).toBeInTheDocument();
|
|
167
|
+
expect(react_2.screen.getByLabelText('More actions')).toBeInTheDocument();
|
|
168
|
+
expect(highlightCrosswalk).toHaveBeenCalledTimes(1);
|
|
169
|
+
return [2 /*return*/];
|
|
170
|
+
}
|
|
179
171
|
});
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
}); });
|
|
173
|
+
it('should hide actions on mouse leave', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
+
var user;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
user = setUp().user;
|
|
179
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
180
|
+
case 1:
|
|
181
|
+
_a.sent();
|
|
182
|
+
expect(react_2.screen.getByLabelText('Pin')).toBeInTheDocument();
|
|
183
|
+
expect(highlightCrosswalk).toHaveBeenCalledTimes(1);
|
|
184
|
+
return [4 /*yield*/, user.unhover(react_2.screen.getByText('Test'))];
|
|
185
|
+
case 2:
|
|
186
|
+
_a.sent();
|
|
187
|
+
expect(react_2.screen.queryByLabelText('Pin')).not.toBeInTheDocument();
|
|
188
|
+
expect(removeHighlight).toHaveBeenCalledTimes(1);
|
|
189
|
+
return [2 /*return*/];
|
|
190
|
+
}
|
|
183
191
|
});
|
|
184
|
-
|
|
185
|
-
expect(wrapper.find(PinButton_1.PinButton).length).toBe(0);
|
|
186
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).length).toBe(0);
|
|
187
|
-
expect(wrapper.find(DropDownMenuButton_1.DropDownMenuButton).length).toBe(0);
|
|
188
|
-
expect(removeHighlight).toHaveBeenCalledTimes(1);
|
|
189
|
-
});
|
|
192
|
+
}); });
|
|
190
193
|
it('should show pin in pinned state even if no hover', function () {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
expect(wrapper.find(PinButton_1.PinButton).length).toBe(1);
|
|
195
|
-
expect(wrapper.find(PinButton_1.PinButton).prop('isPinned')).toBeTruthy();
|
|
196
|
-
expect(wrapper.find(PinButton_1.PinButton).prop('disabled')).toBeFalsy();
|
|
194
|
+
setUp({ attributeValue: __assign(__assign({}, defaultProps.attributeValue), { pin: true }) });
|
|
195
|
+
expect(react_2.screen.getByLabelText('Pin')).not.toBeDisabled();
|
|
196
|
+
expect(react_2.screen.getByTestId('SvgPin')).toBeInTheDocument();
|
|
197
197
|
});
|
|
198
198
|
it('should show ignore in ignored state even if no hover', function () {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).length).toBe(1);
|
|
203
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).prop('isIgnored')).toBeTruthy();
|
|
204
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).prop('disabled')).toBeFalsy();
|
|
205
|
-
});
|
|
206
|
-
it('should show actions with all actions if attribute type allows actions', function () {
|
|
207
|
-
var props = __assign({ attributeValue: value, attributeType: attributeType, crosswalk: crosswalk, className: 'simpleAttribute' }, actions);
|
|
208
|
-
var wrapper = setUp(props);
|
|
209
|
-
var event = {};
|
|
210
|
-
(0, test_utils_1.act)(function () {
|
|
211
|
-
var _a;
|
|
212
|
-
(_a = wrapper.find('.simpleAttribute').at(2).prop('onMouseEnter')) === null || _a === void 0 ? void 0 : _a(event);
|
|
213
|
-
});
|
|
214
|
-
wrapper.update();
|
|
215
|
-
var actionsItems = wrapper.find(DropDownMenuButton_1.DropDownMenuButton).prop('menuItems');
|
|
216
|
-
expect(actionsItems === null || actionsItems === void 0 ? void 0 : actionsItems[1]).toMatchObject({
|
|
217
|
-
disabled: false,
|
|
218
|
-
text: 'Edit',
|
|
219
|
-
tooltip: null
|
|
220
|
-
});
|
|
221
|
-
expect(actionsItems === null || actionsItems === void 0 ? void 0 : actionsItems[2]).toMatchObject({
|
|
222
|
-
disabled: false,
|
|
223
|
-
text: 'Delete',
|
|
224
|
-
tooltip: null
|
|
225
|
-
});
|
|
226
|
-
expect(actionsItems === null || actionsItems === void 0 ? void 0 : actionsItems[0]).toStrictEqual({
|
|
227
|
-
color: color,
|
|
228
|
-
crosswalk: crosswalk
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
it('should disable actions based on attribute type permissions', function () {
|
|
232
|
-
attributeType.access = ['READ'];
|
|
233
|
-
var props = __assign({ attributeValue: value, attributeType: attributeType, crosswalk: crosswalk, className: 'simpleAttribute' }, actions);
|
|
234
|
-
var wrapper = setUp(props);
|
|
235
|
-
var event = {};
|
|
236
|
-
(0, test_utils_1.act)(function () {
|
|
237
|
-
var _a;
|
|
238
|
-
(_a = wrapper.find('.simpleAttribute').at(2).prop('onMouseEnter')) === null || _a === void 0 ? void 0 : _a(event);
|
|
239
|
-
});
|
|
240
|
-
wrapper.update();
|
|
241
|
-
var actionsItems = wrapper.find(DropDownMenuButton_1.DropDownMenuButton).prop('menuItems');
|
|
242
|
-
expect(actionsItems === null || actionsItems === void 0 ? void 0 : actionsItems[1]).toMatchObject({
|
|
243
|
-
disabled: true,
|
|
244
|
-
text: 'Edit',
|
|
245
|
-
tooltip: "You don't have permissions to edit"
|
|
246
|
-
});
|
|
247
|
-
expect(actionsItems === null || actionsItems === void 0 ? void 0 : actionsItems[2]).toMatchObject({
|
|
248
|
-
disabled: true,
|
|
249
|
-
text: 'Delete',
|
|
250
|
-
tooltip: "You don't have permissions to delete"
|
|
251
|
-
});
|
|
252
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).length).toBe(0);
|
|
253
|
-
expect(wrapper.find(PinButton_1.PinButton).length).toBe(0);
|
|
254
|
-
wrapper.setProps({
|
|
255
|
-
attributeValue: __assign(__assign({}, value), { pin: true, ignored: true })
|
|
256
|
-
});
|
|
257
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).prop('disabled')).toBe(true);
|
|
258
|
-
expect(wrapper.find(PinButton_1.PinButton).prop('disabled')).toBe(true);
|
|
259
|
-
});
|
|
260
|
-
it('should disable delete action if props.disableDelete is true', function () {
|
|
261
|
-
var props = __assign({ attributeValue: value, attributeType: attributeType, crosswalk: crosswalk, className: 'simpleAttribute', disableDelete: true }, actions);
|
|
262
|
-
var wrapper = setUp(props);
|
|
263
|
-
var event = {};
|
|
264
|
-
(0, test_utils_1.act)(function () {
|
|
265
|
-
var _a;
|
|
266
|
-
(_a = wrapper.find('.simpleAttribute').at(2).prop('onMouseEnter')) === null || _a === void 0 ? void 0 : _a(event);
|
|
267
|
-
});
|
|
268
|
-
wrapper.update();
|
|
269
|
-
var actionsItems = wrapper.find(DropDownMenuButton_1.DropDownMenuButton).prop('menuItems');
|
|
270
|
-
expect(actionsItems === null || actionsItems === void 0 ? void 0 : actionsItems[1]).toMatchObject({
|
|
271
|
-
disabled: false,
|
|
272
|
-
text: 'Edit',
|
|
273
|
-
tooltip: null
|
|
274
|
-
});
|
|
275
|
-
expect(actionsItems === null || actionsItems === void 0 ? void 0 : actionsItems[2]).toMatchObject({
|
|
276
|
-
disabled: true,
|
|
277
|
-
text: 'Delete',
|
|
278
|
-
tooltip: "You don't have permissions to delete"
|
|
279
|
-
});
|
|
280
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).length).toBe(1);
|
|
281
|
-
expect(wrapper.find(PinButton_1.PinButton).length).toBe(1);
|
|
199
|
+
setUp({ attributeValue: __assign(__assign({}, defaultProps.attributeValue), { ignored: true }) });
|
|
200
|
+
expect(react_2.screen.getByLabelText('Ignore')).not.toBeDisabled();
|
|
201
|
+
expect(react_2.screen.getByTestId('SvgIgnored')).toBeInTheDocument();
|
|
282
202
|
});
|
|
283
|
-
it('should
|
|
284
|
-
var
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
203
|
+
it('should show actions with all actions if attribute type allows actions', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
|
+
var user;
|
|
205
|
+
return __generator(this, function (_a) {
|
|
206
|
+
switch (_a.label) {
|
|
207
|
+
case 0:
|
|
208
|
+
user = setUp({}, true).user;
|
|
209
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
210
|
+
case 1:
|
|
211
|
+
_a.sent();
|
|
212
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
213
|
+
case 2:
|
|
214
|
+
_a.sent();
|
|
215
|
+
expect(react_2.screen.getByLabelText('Focus')).toBeInTheDocument();
|
|
216
|
+
expect(react_2.screen.getByText('Edit')).not.toBeDisabled();
|
|
217
|
+
expect(react_2.screen.getByText('Delete')).not.toBeDisabled();
|
|
218
|
+
return [2 /*return*/];
|
|
219
|
+
}
|
|
297
220
|
});
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
221
|
+
}); });
|
|
222
|
+
it('should disable actions based on attribute type permissions', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
+
var _a, user, rerender, editButton, deleteButton;
|
|
224
|
+
return __generator(this, function (_b) {
|
|
225
|
+
switch (_b.label) {
|
|
226
|
+
case 0:
|
|
227
|
+
_a = setUp({ attributeType: __assign(__assign({}, defaultProps.attributeType), { access: ['READ'] }) }, true), user = _a.user, rerender = _a.rerender;
|
|
228
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
229
|
+
case 1:
|
|
230
|
+
_b.sent();
|
|
231
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
232
|
+
case 2:
|
|
233
|
+
_b.sent();
|
|
234
|
+
editButton = react_2.screen.getByLabelText("You don't have permissions to edit");
|
|
235
|
+
expect(editButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
236
|
+
expect(editButton).toHaveTextContent('Edit');
|
|
237
|
+
deleteButton = react_2.screen.getByLabelText("You don't have permissions to delete");
|
|
238
|
+
expect(deleteButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
239
|
+
expect(deleteButton).toHaveTextContent('Delete');
|
|
240
|
+
rerender(react_1.default.createElement(InlineSimpleAttribute_1.InlineSimpleAttribute, __assign({}, defaultProps, { attributeValue: __assign(__assign({}, defaultProps.attributeValue), { pin: true, ignored: true }), attributeType: __assign(__assign({}, defaultProps.attributeType), { access: ['CREATE'] }) })));
|
|
241
|
+
expect(react_2.screen.getByLabelText("You don't have permissions to pin").children[0]).toBeDisabled();
|
|
242
|
+
expect(react_2.screen.getByLabelText("You don't have permissions to ignore").children[0]).toBeDisabled();
|
|
243
|
+
return [2 /*return*/];
|
|
244
|
+
}
|
|
302
245
|
});
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
246
|
+
}); });
|
|
247
|
+
it('should disable delete action if props.disableDelete is true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
248
|
+
var user, deleteButton;
|
|
249
|
+
return __generator(this, function (_a) {
|
|
250
|
+
switch (_a.label) {
|
|
251
|
+
case 0:
|
|
252
|
+
user = setUp({ disableDelete: true }, true).user;
|
|
253
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
254
|
+
case 1:
|
|
255
|
+
_a.sent();
|
|
256
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
257
|
+
case 2:
|
|
258
|
+
_a.sent();
|
|
259
|
+
deleteButton = react_2.screen.getByLabelText("You don't have permissions to delete");
|
|
260
|
+
expect(deleteButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
261
|
+
expect(deleteButton).toHaveTextContent('Delete');
|
|
262
|
+
expect(react_2.screen.getByText('Edit').parentElement).not.toHaveAttribute('aria-disabled', 'true');
|
|
263
|
+
return [2 /*return*/];
|
|
264
|
+
}
|
|
314
265
|
});
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
266
|
+
}); });
|
|
267
|
+
it('should disable edit, pin and ignore actions if props.disableEdit is true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
+
var user, editButton;
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0:
|
|
272
|
+
user = setUp({ disableEdit: true }, true).user;
|
|
273
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
274
|
+
case 1:
|
|
275
|
+
_a.sent();
|
|
276
|
+
expect(react_2.screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
|
|
277
|
+
expect(react_2.screen.queryByLabelText('Pin')).not.toBeInTheDocument();
|
|
278
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
279
|
+
case 2:
|
|
280
|
+
_a.sent();
|
|
281
|
+
editButton = react_2.screen.getByLabelText("You don't have permissions to edit");
|
|
282
|
+
expect(editButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
283
|
+
expect(editButton).toHaveTextContent('Edit');
|
|
284
|
+
expect(react_2.screen.getByText('Delete').parentElement).not.toHaveAttribute('aria-disabled', 'true');
|
|
285
|
+
return [2 /*return*/];
|
|
286
|
+
}
|
|
322
287
|
});
|
|
323
|
-
});
|
|
324
|
-
it('should
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
288
|
+
}); });
|
|
289
|
+
it('should toggle crosswalk focus on click Focus', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
290
|
+
var user;
|
|
291
|
+
return __generator(this, function (_a) {
|
|
292
|
+
switch (_a.label) {
|
|
293
|
+
case 0:
|
|
294
|
+
user = setUp({}, true).user;
|
|
295
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
296
|
+
case 1:
|
|
297
|
+
_a.sent();
|
|
298
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
299
|
+
case 2:
|
|
300
|
+
_a.sent();
|
|
301
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('Focus'))];
|
|
302
|
+
case 3:
|
|
303
|
+
_a.sent();
|
|
304
|
+
expect(toggleCrosswalkFocus).toHaveBeenCalledWith();
|
|
305
|
+
return [2 /*return*/];
|
|
306
|
+
}
|
|
331
307
|
});
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
308
|
+
}); });
|
|
309
|
+
it('should call props.onDelete on Delete button click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
310
|
+
var user;
|
|
311
|
+
return __generator(this, function (_a) {
|
|
312
|
+
switch (_a.label) {
|
|
313
|
+
case 0:
|
|
314
|
+
user = setUp({}, true).user;
|
|
315
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
316
|
+
case 1:
|
|
317
|
+
_a.sent();
|
|
318
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
319
|
+
case 2:
|
|
320
|
+
_a.sent();
|
|
321
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Delete'))];
|
|
322
|
+
case 3:
|
|
323
|
+
_a.sent();
|
|
324
|
+
expect(defaultProps.onDelete).toHaveBeenCalledWith({
|
|
325
|
+
attributeType: defaultProps.attributeType,
|
|
326
|
+
attributeValue: defaultProps.attributeValue,
|
|
327
|
+
crosswalks: [defaultProps.crosswalk]
|
|
328
|
+
});
|
|
329
|
+
return [2 /*return*/];
|
|
330
|
+
}
|
|
336
331
|
});
|
|
337
|
-
});
|
|
338
|
-
it('should call props.
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
332
|
+
}); });
|
|
333
|
+
it('should call props.onPin on Pin button click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
334
|
+
var user;
|
|
335
|
+
return __generator(this, function (_a) {
|
|
336
|
+
switch (_a.label) {
|
|
337
|
+
case 0:
|
|
338
|
+
user = setUp({}, true).user;
|
|
339
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
340
|
+
case 1:
|
|
341
|
+
_a.sent();
|
|
342
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('Pin').childNodes[0])];
|
|
343
|
+
case 2:
|
|
344
|
+
_a.sent();
|
|
345
|
+
expect(defaultProps.onPin).toHaveBeenCalledWith({
|
|
346
|
+
attributeValue: defaultProps.attributeValue
|
|
347
|
+
});
|
|
348
|
+
return [2 /*return*/];
|
|
349
|
+
}
|
|
345
350
|
});
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
351
|
+
}); });
|
|
352
|
+
it('should call props.onIgnore on Ignore button click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
353
|
+
var user;
|
|
354
|
+
return __generator(this, function (_a) {
|
|
355
|
+
switch (_a.label) {
|
|
356
|
+
case 0:
|
|
357
|
+
user = setUp({}, true).user;
|
|
358
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
359
|
+
case 1:
|
|
360
|
+
_a.sent();
|
|
361
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('Ignore').childNodes[0])];
|
|
362
|
+
case 2:
|
|
363
|
+
_a.sent();
|
|
364
|
+
expect(defaultProps.onIgnore).toHaveBeenCalledWith({
|
|
365
|
+
attributeValue: defaultProps.attributeValue
|
|
366
|
+
});
|
|
367
|
+
return [2 /*return*/];
|
|
368
|
+
}
|
|
350
369
|
});
|
|
351
|
-
});
|
|
370
|
+
}); });
|
|
352
371
|
it('should render InlineSimpleAttributeEditor on Edit menu item click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
353
|
-
var
|
|
372
|
+
var user;
|
|
354
373
|
return __generator(this, function (_a) {
|
|
355
374
|
switch (_a.label) {
|
|
356
375
|
case 0:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
onMouseEnter = wrapper.find('.simpleAttribute').at(2).prop('onMouseEnter');
|
|
360
|
-
(0, test_utils_1.act)(function () {
|
|
361
|
-
onMouseEnter();
|
|
362
|
-
});
|
|
363
|
-
wrapper.update();
|
|
364
|
-
actionItems = wrapper.find(DropDownMenuButton_1.DropDownMenuButton).prop('menuItems');
|
|
365
|
-
return [4 /*yield*/, (0, test_utils_1.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
366
|
-
var _a, _b;
|
|
367
|
-
return __generator(this, function (_c) {
|
|
368
|
-
(_b = (_a = actionItems[1]).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
369
|
-
return [2 /*return*/];
|
|
370
|
-
});
|
|
371
|
-
}); })];
|
|
376
|
+
user = setUp({}, true).user;
|
|
377
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
372
378
|
case 1:
|
|
373
379
|
_a.sent();
|
|
374
|
-
|
|
375
|
-
|
|
380
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
381
|
+
case 2:
|
|
382
|
+
_a.sent();
|
|
383
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Edit'))];
|
|
384
|
+
case 3:
|
|
385
|
+
_a.sent();
|
|
386
|
+
expect(react_2.screen.getByTestId('inline-simple-attribute-editor')).toBeInTheDocument();
|
|
376
387
|
return [2 /*return*/];
|
|
377
388
|
}
|
|
378
389
|
});
|
|
379
390
|
}); });
|
|
380
391
|
it('should call props.onEdit when call onEdit prop of InlineSimpleAttributeEditor', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
381
|
-
var
|
|
392
|
+
var user, backdrop;
|
|
382
393
|
return __generator(this, function (_a) {
|
|
383
394
|
switch (_a.label) {
|
|
384
395
|
case 0:
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
event = {};
|
|
388
|
-
(0, test_utils_1.act)(function () {
|
|
389
|
-
var _a;
|
|
390
|
-
(_a = wrapper.find('.simpleAttribute').at(2).prop('onMouseEnter')) === null || _a === void 0 ? void 0 : _a(event);
|
|
391
|
-
});
|
|
392
|
-
wrapper.update();
|
|
393
|
-
actionItems = wrapper.find(DropDownMenuButton_1.DropDownMenuButton).prop('menuItems');
|
|
394
|
-
return [4 /*yield*/, (0, test_utils_1.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
395
|
-
var _a, _b;
|
|
396
|
-
return __generator(this, function (_c) {
|
|
397
|
-
(_b = (_a = actionItems[1]).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
398
|
-
return [2 /*return*/];
|
|
399
|
-
});
|
|
400
|
-
}); })];
|
|
396
|
+
user = setUp({}, true).user;
|
|
397
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
401
398
|
case 1:
|
|
402
399
|
_a.sent();
|
|
403
|
-
|
|
404
|
-
newAttributeValue = {
|
|
405
|
-
uri: 'entities/123/attributes/String/123',
|
|
406
|
-
value: 'Test update'
|
|
407
|
-
};
|
|
408
|
-
return [4 /*yield*/, (0, test_utils_1.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
409
|
-
return __generator(this, function (_a) {
|
|
410
|
-
wrapper.find(InlineSimpleAttributeEditor_1.InlineSimpleAttributeEditor).prop('onEdit')(newAttributeValue);
|
|
411
|
-
return [2 /*return*/];
|
|
412
|
-
});
|
|
413
|
-
}); })];
|
|
400
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
414
401
|
case 2:
|
|
415
402
|
_a.sent();
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
403
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Edit'))];
|
|
404
|
+
case 3:
|
|
405
|
+
_a.sent();
|
|
406
|
+
expect(react_2.screen.getByTestId('inline-simple-attribute-editor')).toBeInTheDocument();
|
|
407
|
+
return [4 /*yield*/, user.type(react_2.screen.getByRole('textbox'), ' update')];
|
|
408
|
+
case 4:
|
|
409
|
+
_a.sent();
|
|
410
|
+
backdrop = react_2.screen.getByRole('presentation').childNodes[0];
|
|
411
|
+
return [4 /*yield*/, user.click(backdrop)];
|
|
412
|
+
case 5:
|
|
413
|
+
_a.sent();
|
|
414
|
+
expect(defaultProps.onEdit).toHaveBeenCalledWith({
|
|
415
|
+
attributeType: defaultProps.attributeType,
|
|
416
|
+
attributeValue: __assign(__assign({}, defaultProps.attributeValue), { uri: defaultProps.attributeValue.uri, value: 'Test update' }),
|
|
417
|
+
crosswalk: defaultProps.crosswalk
|
|
420
418
|
});
|
|
421
419
|
return [2 /*return*/];
|
|
422
420
|
}
|
|
423
421
|
});
|
|
424
422
|
}); });
|
|
425
|
-
it('should disable edit, pin, delete and ignore actions if it is system attribute', function () {
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
});
|
|
448
|
-
it('should hide pin and ignore button for temporary attribute', function () {
|
|
449
|
-
var props = __assign({ attributeValue: (0, mdm_sdk_1.createNewAttribute)({ parentUri: 'entities/123', attributeType: attributeType }), attributeType: attributeType, crosswalk: crosswalk, className: 'simpleAttribute' }, actions);
|
|
450
|
-
var wrapper = setUp(props);
|
|
451
|
-
(0, test_utils_1.act)(function () {
|
|
452
|
-
wrapper.find('.root').simulate('mouseenter');
|
|
453
|
-
});
|
|
454
|
-
wrapper.update();
|
|
455
|
-
expect(wrapper.find(IgnoreButton_1.IgnoreButton).length).toBe(0);
|
|
456
|
-
expect(wrapper.find(PinButton_1.PinButton).length).toBe(0);
|
|
457
|
-
});
|
|
458
|
-
it('should disable edit, pin, delete and ignore actions if crosswalk is disabled', function () {
|
|
459
|
-
mdm_sdk_1.isCrosswalkDisabled.mockReturnValue(true);
|
|
460
|
-
var props = __assign({ attributeValue: value, attributeType: attributeType, crosswalk: crosswalk, className: 'simpleAttribute' }, actions);
|
|
461
|
-
var wrapper = setUp(props);
|
|
462
|
-
var event = {};
|
|
463
|
-
(0, test_utils_1.act)(function () {
|
|
464
|
-
var _a;
|
|
465
|
-
(_a = wrapper.find('.simpleAttribute').at(2).prop('onMouseEnter')) === null || _a === void 0 ? void 0 : _a(event);
|
|
423
|
+
it('should disable edit, pin, delete and ignore actions if it is system attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
424
|
+
var user, editButton, deleteButton;
|
|
425
|
+
return __generator(this, function (_a) {
|
|
426
|
+
switch (_a.label) {
|
|
427
|
+
case 0:
|
|
428
|
+
user = setUp({ attributeType: __assign(__assign({}, defaultProps.attributeType), { system: true }) }, true).user;
|
|
429
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
430
|
+
case 1:
|
|
431
|
+
_a.sent();
|
|
432
|
+
expect(react_2.screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
|
|
433
|
+
expect(react_2.screen.queryByLabelText('Pin')).not.toBeInTheDocument();
|
|
434
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
435
|
+
case 2:
|
|
436
|
+
_a.sent();
|
|
437
|
+
editButton = react_2.screen.getByLabelText("You don't have permissions to edit");
|
|
438
|
+
expect(editButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
439
|
+
expect(editButton).toHaveTextContent('Edit');
|
|
440
|
+
deleteButton = react_2.screen.getByLabelText("You don't have permissions to delete");
|
|
441
|
+
expect(deleteButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
442
|
+
expect(deleteButton).toHaveTextContent('Delete');
|
|
443
|
+
return [2 /*return*/];
|
|
444
|
+
}
|
|
466
445
|
});
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
446
|
+
}); });
|
|
447
|
+
it('should hide pin and ignore button for temporary attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
448
|
+
var user;
|
|
449
|
+
return __generator(this, function (_a) {
|
|
450
|
+
switch (_a.label) {
|
|
451
|
+
case 0:
|
|
452
|
+
user = setUp({
|
|
453
|
+
attributeValue: __assign(__assign({}, (0, mdm_sdk_1.createNewAttribute)({ parentUri: 'entities/123', attributeType: defaultProps.attributeType })), { value: 'Test' })
|
|
454
|
+
}).user;
|
|
455
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
456
|
+
case 1:
|
|
457
|
+
_a.sent();
|
|
458
|
+
expect(react_2.screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
|
|
459
|
+
expect(react_2.screen.queryByLabelText('Pin')).not.toBeInTheDocument();
|
|
460
|
+
return [2 /*return*/];
|
|
461
|
+
}
|
|
473
462
|
});
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
463
|
+
}); });
|
|
464
|
+
it('should disable edit, pin, delete and ignore actions if crosswalk is disabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
465
|
+
var user, editButton, deleteButton;
|
|
466
|
+
return __generator(this, function (_a) {
|
|
467
|
+
switch (_a.label) {
|
|
468
|
+
case 0:
|
|
469
|
+
user = setUp({ crosswalk: __assign(__assign({}, defaultProps.crosswalk), { deleteDate: Date.now() - 2000 }) }, true).user;
|
|
470
|
+
return [4 /*yield*/, user.hover(react_2.screen.getByText('Test'))];
|
|
471
|
+
case 1:
|
|
472
|
+
_a.sent();
|
|
473
|
+
expect(react_2.screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
|
|
474
|
+
expect(react_2.screen.queryByLabelText('Pin')).not.toBeInTheDocument();
|
|
475
|
+
return [4 /*yield*/, user.click(react_2.screen.getByLabelText('More actions'))];
|
|
476
|
+
case 2:
|
|
477
|
+
_a.sent();
|
|
478
|
+
editButton = react_2.screen.getByLabelText("You don't have permissions to edit");
|
|
479
|
+
expect(editButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
480
|
+
expect(editButton).toHaveTextContent('Edit');
|
|
481
|
+
deleteButton = react_2.screen.getByLabelText("You don't have permissions to delete");
|
|
482
|
+
expect(deleteButton.children[0]).toHaveAttribute('aria-disabled', 'true');
|
|
483
|
+
expect(deleteButton).toHaveTextContent('Delete');
|
|
484
|
+
return [2 /*return*/];
|
|
485
|
+
}
|
|
478
486
|
});
|
|
479
|
-
|
|
480
|
-
expect(wrapper.find(PinButton_1.PinButton).length).toBe(0);
|
|
481
|
-
});
|
|
487
|
+
}); });
|
|
482
488
|
});
|