@reltio/components 1.4.1905 → 1.4.1907
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/cjs/ActionsPanel/ActionsPanel.test.js +133 -49
- package/cjs/AttributeListItem/AttributeListItem.spec.js +147 -118
- package/cjs/AttributeSelector/AttributeSelector.specs.js +125 -193
- package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
- package/cjs/AttributesErrorsPanel/components/Error/Error.specs.js +96 -90
- package/cjs/AttributesErrorsPanel/store.test-data.d.ts +22 -0
- package/cjs/AttributesErrorsPanel/store.test-data.js +29 -0
- package/cjs/AttributesFilterSelector/AttributesFilterSelector.test.js +127 -105
- package/cjs/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
- package/cjs/AttributesValuesEditor/AttributesValuesEditor.test.js +92 -88
- package/cjs/AttributesView/AttributesView.test.js +67 -34
- package/cjs/AutoSizeList/AutoSizeList.test.js +81 -59
- package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +15 -31
- package/cjs/BarChart/BarChart.test.js +128 -65
- package/cjs/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
- package/cjs/BasicViewContent/BasicViewContent.test.js +7 -9
- package/cjs/BlobRenderer/BlobRenderer.test.js +28 -9
- package/cjs/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
- package/cjs/BubbleChart/BubbleChart.test.js +111 -87
- package/cjs/CloudChart/CloudChart.test.js +95 -36
- package/cjs/CollaborationItem/CollaborationItem.test.js +67 -30
- package/cjs/CollaborationItem/components/Comment/Comment.test.js +221 -189
- package/cjs/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -81
- package/cjs/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
- package/cjs/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
- package/cjs/CollapseButton/CollapseButton.test.js +74 -15
- package/cjs/CollapseRowButton/CollapseRowButton.test.js +82 -24
- package/cjs/ColorBar/ColorBar.test.js +13 -15
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
- package/cjs/CommentsContainer/CommentsContainer.test.js +282 -211
- package/cjs/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +183 -122
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
- package/cjs/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
- package/cjs/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
- package/cjs/ConnectionEditor/ConnectionEditor.test.js +299 -282
- package/cjs/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +3 -1
- package/cjs/ReactSortableTree/ReactSortableTree.js +2 -7
- package/cjs/RelationTypeSelector/RelationTypeSelector.d.ts +3 -1
- package/cjs/types/index.d.ts +1 -1
- package/esm/ActionsPanel/ActionsPanel.test.js +133 -49
- package/esm/AttributeListItem/AttributeListItem.spec.js +149 -97
- package/esm/AttributeSelector/AttributeSelector.specs.js +125 -193
- package/esm/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
- package/esm/AttributesErrorsPanel/components/Error/Error.specs.js +98 -72
- package/esm/AttributesErrorsPanel/store.test-data.d.ts +22 -0
- package/esm/AttributesErrorsPanel/store.test-data.js +26 -0
- package/esm/AttributesFilterSelector/AttributesFilterSelector.test.js +129 -84
- package/esm/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
- package/esm/AttributesValuesEditor/AttributesValuesEditor.test.js +94 -67
- package/esm/AttributesView/AttributesView.test.js +67 -34
- package/esm/AutoSizeList/AutoSizeList.test.js +81 -59
- package/esm/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +16 -32
- package/esm/BarChart/BarChart.test.js +128 -65
- package/esm/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
- package/esm/BasicViewContent/BasicViewContent.test.js +7 -9
- package/esm/BlobRenderer/BlobRenderer.test.js +28 -9
- package/esm/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
- package/esm/BubbleChart/BubbleChart.test.js +111 -87
- package/esm/CloudChart/CloudChart.test.js +95 -36
- package/esm/CollaborationItem/CollaborationItem.test.js +67 -30
- package/esm/CollaborationItem/components/Comment/Comment.test.js +221 -189
- package/esm/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -58
- package/esm/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
- package/esm/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
- package/esm/CollapseButton/CollapseButton.test.js +74 -15
- package/esm/CollapseRowButton/CollapseRowButton.test.js +82 -24
- package/esm/ColorBar/ColorBar.test.js +13 -15
- package/esm/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
- package/esm/CommentsContainer/CommentsContainer.test.js +282 -211
- package/esm/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +182 -101
- package/esm/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
- package/esm/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
- package/esm/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
- package/esm/ConnectionEditor/ConnectionEditor.test.js +300 -283
- package/esm/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +3 -1
- package/esm/ReactSortableTree/ReactSortableTree.js +2 -7
- package/esm/RelationTypeSelector/RelationTypeSelector.d.ts +3 -1
- package/esm/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -100
- package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
- package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -46
- package/cjs/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
- package/cjs/AvatarWithFallback/AvatarWithFallback.specs.js +0 -27
- package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
- package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -27
- package/cjs/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
- package/cjs/CollaborationItem/components/Avatar/Avatar.test.js +0 -15
- package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
- package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -80
- package/esm/ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts +0 -1
- package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts +0 -1
- package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -95
- package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
- package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -41
- package/esm/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
- package/esm/AvatarWithFallback/AvatarWithFallback.specs.js +0 -22
- package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
- package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -22
- package/esm/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
- package/esm/CollaborationItem/components/Avatar/Avatar.test.js +0 -10
- package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
- package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -55
- /package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts → AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
- /package/{cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts → esm/AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
|
@@ -9,124 +9,205 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "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
|
+
};
|
|
48
|
+
import React from 'react';
|
|
49
|
+
import userEvent from '@testing-library/user-event';
|
|
50
|
+
import { render, screen } from '@testing-library/react';
|
|
14
51
|
import { CollaborationObjectTypes } from '@reltio/mdm-sdk';
|
|
15
|
-
import { PopupWithArrow } from '../../../PopupWithArrow';
|
|
16
|
-
import { CollaborationItem } from '../../../CollaborationItem';
|
|
17
52
|
import { CollaborationPopup } from './CollaborationPopup';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
modifiedTime: 1620280061505,
|
|
27
|
-
deleted: false,
|
|
28
|
-
visibility: 'public',
|
|
29
|
-
status: 'resolved',
|
|
30
|
-
objectId: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5',
|
|
31
|
-
objectType: CollaborationObjectTypes.ENTITY_ATTRIBUTE,
|
|
32
|
-
permanentLink: 'http://localhost:3000/ui/sokol/#p~com.reltio.plugins.entity.perspective.HCA_e~entities%2F13JKIKAz_ps~profile_cmt~00001lo',
|
|
33
|
-
content: 'comment',
|
|
34
|
-
namedUsers: [],
|
|
35
|
-
replies: [],
|
|
36
|
-
relatedObjectUris: ['entities/13JKIKAz']
|
|
37
|
-
};
|
|
38
|
-
if (hasReplies) {
|
|
39
|
-
comment.replies.push({
|
|
40
|
-
selfLink: 'https://cservice-dev.reltio.com/tst-01/sokol/comments/00001lo/replies/000007s',
|
|
41
|
-
replyId: '000007s',
|
|
53
|
+
import { CollaborationContext } from '../../../contexts/CollaborationContext';
|
|
54
|
+
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
55
|
+
describe('CollaborationPopup tests', function () {
|
|
56
|
+
var createComment = function (hasReplies) {
|
|
57
|
+
if (hasReplies === void 0) { hasReplies = false; }
|
|
58
|
+
var comment = {
|
|
59
|
+
selfLink: 'https://cservice-dev.reltio.com/tst-01/sokol/comments/00001lo',
|
|
60
|
+
commentId: '00001lo',
|
|
42
61
|
createdBy: 'vyacheslav.kovyazin',
|
|
43
|
-
createdTime:
|
|
62
|
+
createdTime: 1620280049022,
|
|
44
63
|
modifiedTime: 1620280061505,
|
|
45
64
|
deleted: false,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
visibility: 'public',
|
|
66
|
+
status: 'resolved',
|
|
67
|
+
objectId: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5',
|
|
68
|
+
objectType: CollaborationObjectTypes.ENTITY_ATTRIBUTE,
|
|
69
|
+
permanentLink: 'http://localhost:3000/ui/sokol/#p~com.reltio.plugins.entity.perspective.HCA_e~entities%2F13JKIKAz_ps~profile_cmt~00001lo',
|
|
70
|
+
content: 'comment',
|
|
71
|
+
namedUsers: [],
|
|
72
|
+
replies: [],
|
|
73
|
+
relatedObjectUris: ['entities/13JKIKAz']
|
|
74
|
+
};
|
|
75
|
+
if (hasReplies) {
|
|
76
|
+
comment.replies.push({
|
|
77
|
+
selfLink: 'https://cservice-dev.reltio.com/tst-01/sokol/comments/00001lo/replies/000007s',
|
|
78
|
+
replyId: '000007s',
|
|
79
|
+
createdBy: 'vyacheslav.kovyazin',
|
|
80
|
+
createdTime: 1620280061505,
|
|
81
|
+
modifiedTime: 1620280061505,
|
|
82
|
+
deleted: false,
|
|
83
|
+
action: 'none',
|
|
84
|
+
content: 'abc',
|
|
85
|
+
namedUsers: []
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return comment;
|
|
89
|
+
};
|
|
90
|
+
var createProps = function (comment) {
|
|
91
|
+
var onClose = jest.fn();
|
|
92
|
+
return {
|
|
93
|
+
comment: comment,
|
|
94
|
+
uri: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5',
|
|
95
|
+
relatedObjectUris: ['entities/13JKIKAz'],
|
|
96
|
+
objectType: CollaborationObjectTypes.ENTITY_ATTRIBUTE,
|
|
97
|
+
onClose: onClose,
|
|
98
|
+
anchorEl: document.body,
|
|
99
|
+
open: true
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
var entity = {
|
|
103
|
+
type: 'configuration/entityTypes/HCP',
|
|
104
|
+
uri: 'entities/02ZRRE9',
|
|
105
|
+
attributes: {
|
|
106
|
+
FirstName: [
|
|
107
|
+
{
|
|
108
|
+
type: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
109
|
+
ov: true,
|
|
110
|
+
value: 'nameValue',
|
|
111
|
+
uri: 'entities/02ZRRE9/attributes/FirstName/15p60Tel'
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var metadata = {
|
|
117
|
+
entityTypes: [
|
|
118
|
+
{
|
|
119
|
+
uri: 'configuration/entityTypes/HCP',
|
|
120
|
+
attributes: [
|
|
121
|
+
{
|
|
122
|
+
uri: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
123
|
+
type: 'String',
|
|
124
|
+
name: 'FirstName',
|
|
125
|
+
label: 'First Name',
|
|
126
|
+
access: ['READ', 'CREATE', 'UPDATE', 'INITIATE_CHANGE_REQUEST']
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
var actions = {
|
|
133
|
+
removeAttribute: function () { }
|
|
134
|
+
};
|
|
135
|
+
var mdmDefaultValues = {
|
|
136
|
+
user: {
|
|
137
|
+
username: 'test.testmail'
|
|
138
|
+
},
|
|
139
|
+
entity: entity,
|
|
140
|
+
metadata: metadata,
|
|
141
|
+
modifiedEntities: { 'entities/02ZRRE9': entity },
|
|
142
|
+
dependentLookups: { editors: {}, structure: {}, initedTypeUris: [] }
|
|
143
|
+
};
|
|
144
|
+
var defaultCollaborationContextValue = {
|
|
145
|
+
getCommentState: jest.fn().mockReturnValue({}),
|
|
146
|
+
resolveThread: jest.fn(),
|
|
147
|
+
sending: false,
|
|
148
|
+
loading: false
|
|
149
|
+
};
|
|
150
|
+
var setUp = function (_a) {
|
|
151
|
+
var props = _a.props, _b = _a.collaborationContextValue, collaborationContextValue = _b === void 0 ? defaultCollaborationContextValue : _b;
|
|
152
|
+
var Providers = function (_a) {
|
|
153
|
+
var children = _a.children;
|
|
154
|
+
return (React.createElement(MdmModuleProvider, { values: mdmDefaultValues, actions: actions },
|
|
155
|
+
React.createElement(CollaborationContext.Provider, { value: collaborationContextValue }, children)));
|
|
156
|
+
};
|
|
157
|
+
var user = userEvent.setup();
|
|
158
|
+
return __assign({ user: user }, render(React.createElement(CollaborationPopup, __assign({}, props)), { wrapper: Providers }));
|
|
63
159
|
};
|
|
64
|
-
};
|
|
65
|
-
var resolveThread = jest.fn();
|
|
66
|
-
var mockCollaborationContext = function (sending, loading) {
|
|
67
|
-
if (sending === void 0) { sending = false; }
|
|
68
|
-
if (loading === void 0) { loading = false; }
|
|
69
|
-
return jest.spyOn(react, 'useContext').mockImplementation(function () { return ({
|
|
70
|
-
sending: sending,
|
|
71
|
-
loading: loading,
|
|
72
|
-
resolveThread: resolveThread
|
|
73
|
-
}); });
|
|
74
|
-
};
|
|
75
|
-
describe('CollaborationPopup tests', function () {
|
|
76
|
-
afterEach(function () {
|
|
77
|
-
jest.resetAllMocks();
|
|
78
|
-
});
|
|
79
|
-
it('should render popup correctly', function () {
|
|
80
|
-
mockCollaborationContext();
|
|
81
|
-
var props = createProps(createComment());
|
|
82
|
-
var component = shallow(React.createElement(CollaborationPopup, __assign({}, props)));
|
|
83
|
-
var popup = component.find(PopupWithArrow);
|
|
84
|
-
expect(popup).toHaveLength(1);
|
|
85
|
-
expect(popup.props()).toMatchObject({
|
|
86
|
-
open: true,
|
|
87
|
-
onClose: props.onClose,
|
|
88
|
-
anchorEl: props.anchorEl,
|
|
89
|
-
className: 'popper'
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
160
|
it('should render correctly if comment do not exists', function () {
|
|
93
|
-
mockCollaborationContext();
|
|
94
161
|
var props = createProps();
|
|
95
|
-
|
|
96
|
-
expect(
|
|
97
|
-
expect(
|
|
98
|
-
expect(component.find(CollaborationItem)).toHaveLength(1);
|
|
162
|
+
setUp({ props: props });
|
|
163
|
+
expect(document.querySelector('.counter')).not.toBeInTheDocument();
|
|
164
|
+
expect(screen.queryByRole('textbox')).toBeInTheDocument();
|
|
99
165
|
});
|
|
100
166
|
it('should render correctly if comment exists and loading is "false"', function () {
|
|
101
|
-
mockCollaborationContext();
|
|
102
167
|
var props = createProps(createComment());
|
|
103
|
-
|
|
104
|
-
expect(
|
|
105
|
-
expect(
|
|
106
|
-
expect(
|
|
168
|
+
setUp({ props: props });
|
|
169
|
+
expect(document.querySelector('.counter')).toHaveTextContent('1 item');
|
|
170
|
+
expect(screen.queryByRole('button', { name: '' })).toBeInTheDocument();
|
|
171
|
+
expect(screen.queryByRole('textbox')).toBeInTheDocument();
|
|
107
172
|
});
|
|
108
173
|
it('should render correctly if loading is "true"', function () {
|
|
109
|
-
mockCollaborationContext(false, true);
|
|
110
174
|
var props = createProps(createComment());
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
175
|
+
setUp({
|
|
176
|
+
props: props,
|
|
177
|
+
collaborationContextValue: __assign(__assign({}, defaultCollaborationContextValue), { loading: true })
|
|
178
|
+
});
|
|
179
|
+
expect(document.querySelector('.counter')).not.toBeInTheDocument();
|
|
180
|
+
expect(screen.queryByRole('button', { name: '' })).not.toBeInTheDocument();
|
|
181
|
+
expect(screen.queryByRole('textbox')).not.toBeInTheDocument();
|
|
115
182
|
});
|
|
116
183
|
it('should disable resolveButton if sending is "true"', function () {
|
|
117
|
-
mockCollaborationContext(true, false);
|
|
118
|
-
var props = createProps(createComment());
|
|
119
|
-
var component = shallow(React.createElement(CollaborationPopup, __assign({}, props)));
|
|
120
|
-
expect(component.find('.resolveButton').prop('disabled')).toBe(true);
|
|
121
|
-
});
|
|
122
|
-
it('handleResolve handler should work correctly', function () {
|
|
123
|
-
mockCollaborationContext();
|
|
124
184
|
var props = createProps(createComment());
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
commentId: '00001lo',
|
|
129
|
-
uri: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5'
|
|
185
|
+
setUp({
|
|
186
|
+
props: props,
|
|
187
|
+
collaborationContextValue: __assign(__assign({}, defaultCollaborationContextValue), { sending: true })
|
|
130
188
|
});
|
|
189
|
+
expect(screen.queryByRole('button', { name: '' })).toBeDisabled();
|
|
131
190
|
});
|
|
191
|
+
it('handleResolve handler should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
+
var props, resolveThread, user;
|
|
193
|
+
return __generator(this, function (_a) {
|
|
194
|
+
switch (_a.label) {
|
|
195
|
+
case 0:
|
|
196
|
+
props = createProps(createComment());
|
|
197
|
+
resolveThread = jest.fn();
|
|
198
|
+
user = setUp({
|
|
199
|
+
props: props,
|
|
200
|
+
collaborationContextValue: __assign(__assign({}, defaultCollaborationContextValue), { resolveThread: resolveThread })
|
|
201
|
+
}).user;
|
|
202
|
+
return [4 /*yield*/, user.click(screen.getByRole('button', { name: '' }))];
|
|
203
|
+
case 1:
|
|
204
|
+
_a.sent();
|
|
205
|
+
expect(resolveThread).toHaveBeenCalledWith({
|
|
206
|
+
commentId: '00001lo',
|
|
207
|
+
uri: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5'
|
|
208
|
+
});
|
|
209
|
+
return [2 /*return*/];
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}); });
|
|
132
213
|
});
|
|
@@ -1,10 +1,28 @@
|
|
|
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 {
|
|
4
|
-
import { AttributeListItem } from '../AttributeListItem';
|
|
5
|
-
import { Highlighter } from '../Highlighter';
|
|
13
|
+
import userEvent from '@testing-library/user-event';
|
|
14
|
+
import { render, screen, within } from '@testing-library/react';
|
|
6
15
|
import { ConfigureColumnsPopup } from './ConfigureColumnsPopup';
|
|
7
16
|
describe('ConfigureColumnsPopup tests', function () {
|
|
17
|
+
var defaultProps = {
|
|
18
|
+
selected: [],
|
|
19
|
+
anchorEl: document.body,
|
|
20
|
+
open: true
|
|
21
|
+
};
|
|
22
|
+
var setUp = function (props) {
|
|
23
|
+
var user = userEvent.setup();
|
|
24
|
+
return __assign({ user: user }, render(React.createElement(ConfigureColumnsPopup, __assign({}, props))));
|
|
25
|
+
};
|
|
8
26
|
it('should render all components', function () {
|
|
9
27
|
var data = [
|
|
10
28
|
{
|
|
@@ -16,12 +34,10 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
16
34
|
label: 'item2'
|
|
17
35
|
}
|
|
18
36
|
];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
expect(
|
|
23
|
-
expect(selectionPopup.prop('title')).toBe('Show/hide columns');
|
|
24
|
-
expect(component.find(AttributeListItem)).toHaveLength(2);
|
|
37
|
+
setUp(__assign(__assign({}, defaultProps), { data: data }));
|
|
38
|
+
expect(screen.queryByRole('menuitem', { name: data[0].label })).toBeInTheDocument();
|
|
39
|
+
expect(screen.queryByRole('menuitem', { name: data[1].label })).toBeInTheDocument();
|
|
40
|
+
expect(screen.queryByText('Show/hide columns')).toBeInTheDocument();
|
|
25
41
|
});
|
|
26
42
|
it('should render nested items with their children', function () {
|
|
27
43
|
var data = [
|
|
@@ -48,15 +64,12 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
48
64
|
]
|
|
49
65
|
}
|
|
50
66
|
];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
expect(
|
|
56
|
-
expect(
|
|
57
|
-
expect(items.at(2).prop('level')).toBe(0);
|
|
58
|
-
expect(items.at(3).prop('level')).toBe(1);
|
|
59
|
-
expect(items.at(4).prop('level')).toBe(1);
|
|
67
|
+
setUp(__assign(__assign({}, defaultProps), { data: data }));
|
|
68
|
+
expect(screen.getByRole('menuitem', { name: data[0].label }).querySelector('.marginWrapper')).toHaveStyle({
|
|
69
|
+
'margin-left': '0px'
|
|
70
|
+
});
|
|
71
|
+
expect(screen.getByRole('menuitem', { name: data[2].children[0].label }).querySelector('.marginWrapper')).toHaveStyle({ 'margin-left': '20px' });
|
|
72
|
+
expect(screen.getByRole('menuitem', { name: data[2].children[1].label }).querySelector('.marginWrapper')).toHaveStyle({ 'margin-left': '20px' });
|
|
60
73
|
});
|
|
61
74
|
it('should show parent items for filtered subitems', function () {
|
|
62
75
|
var data = [
|
|
@@ -83,24 +96,14 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
83
96
|
]
|
|
84
97
|
}
|
|
85
98
|
];
|
|
86
|
-
var selected = [];
|
|
87
99
|
var filterText = 'subitem';
|
|
88
|
-
|
|
89
|
-
var
|
|
90
|
-
expect(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
expect(
|
|
95
|
-
expect(items.at(1).prop('labelInText')).toBe('Nested item');
|
|
96
|
-
expect(getLabel(1).find(Highlighter).prop('text')).toBe('Nested item');
|
|
97
|
-
expect(getLabel(1).find(Highlighter).prop('highlight')).toBe(filterText);
|
|
98
|
-
expect(items.at(2).prop('labelInText')).toBe('subitem3');
|
|
99
|
-
expect(getLabel(2).find(Highlighter).prop('text')).toBe('subitem3');
|
|
100
|
-
expect(getLabel(2).find(Highlighter).prop('highlight')).toBe(filterText);
|
|
101
|
-
expect(items.at(3).prop('labelInText')).toBe('subitem4');
|
|
102
|
-
expect(getLabel(3).find(Highlighter).prop('text')).toBe('subitem4');
|
|
103
|
-
expect(getLabel(3).find(Highlighter).prop('highlight')).toBe(filterText);
|
|
100
|
+
setUp(__assign(__assign({}, defaultProps), { filterText: filterText, data: data }));
|
|
101
|
+
var subItems = screen.getAllByText(filterText);
|
|
102
|
+
expect(subItems).toHaveLength(3);
|
|
103
|
+
subItems.forEach(function (subItem) {
|
|
104
|
+
expect(subItem).toHaveClass('highlight');
|
|
105
|
+
});
|
|
106
|
+
expect(screen.getByRole('menuitem', { name: 'Nested item' })).toBeInTheDocument();
|
|
104
107
|
});
|
|
105
108
|
it('should show parent items as checked for checked subitems', function () {
|
|
106
109
|
var data = [
|
|
@@ -132,10 +135,8 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
132
135
|
id: '3.1'
|
|
133
136
|
}
|
|
134
137
|
];
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
expect(
|
|
138
|
-
expect(checkedItems.at(0).prop('labelInText')).toBe('Nested item');
|
|
139
|
-
expect(checkedItems.at(1).prop('labelInText')).toBe('subitem3');
|
|
138
|
+
setUp(__assign(__assign({}, defaultProps), { selected: selected, data: data }));
|
|
139
|
+
expect(within(screen.getByRole('menuitem', { name: 'Nested item' })).getByRole('checkbox')).toBeChecked();
|
|
140
|
+
expect(within(screen.getByRole('menuitem', { name: 'subitem3' })).getByRole('checkbox')).toBeChecked();
|
|
140
141
|
});
|
|
141
142
|
});
|
|
@@ -9,38 +9,87 @@ 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;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "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 { shallow } from 'enzyme';
|
|
14
|
-
import Button from '@mui/material/Button';
|
|
15
|
-
import Dialog from '@mui/material/Dialog';
|
|
16
|
-
import DialogActions from '@mui/material/DialogActions';
|
|
17
|
-
import DialogContent from '@mui/material/DialogContent';
|
|
18
|
-
import DialogContentText from '@mui/material/DialogContentText';
|
|
19
49
|
import { ConfirmDeleteDialog } from './ConfirmDeleteDialog';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
|
+
import { render, screen } from '@testing-library/react';
|
|
20
52
|
describe('ConfirmDeleteDialog tests', function () {
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
53
|
+
var setUp = function () {
|
|
54
|
+
var onClose = jest.fn();
|
|
55
|
+
var onConfirm = jest.fn();
|
|
56
|
+
var user = userEvent.setup();
|
|
57
|
+
return __assign({ user: user, onClose: onClose, onConfirm: onConfirm }, render(React.createElement(ConfirmDeleteDialog, { open: true, onClose: onClose, onConfirm: onConfirm })));
|
|
25
58
|
};
|
|
26
59
|
it('should render correctly', function () {
|
|
27
|
-
|
|
28
|
-
expect(
|
|
29
|
-
|
|
30
|
-
expect(
|
|
31
|
-
expect(buttons.length).toBe(2);
|
|
32
|
-
expect(buttons.at(0).text()).toBe('No');
|
|
33
|
-
expect(buttons.at(0).prop('onClick')).toBe(props.onClose);
|
|
34
|
-
expect(buttons.at(1).text()).toBe('Yes');
|
|
35
|
-
});
|
|
36
|
-
it('should call props.onConfirm and props.onClose when click "Yes" button', function () {
|
|
37
|
-
var wrapper = shallow(React.createElement(ConfirmDeleteDialog, __assign({}, props)));
|
|
38
|
-
expect(wrapper.find(Dialog).prop('open')).toBe(props.open);
|
|
39
|
-
wrapper
|
|
40
|
-
.find(Button)
|
|
41
|
-
.filterWhere(function (button) { return button.text() === 'Yes'; })
|
|
42
|
-
.simulate('click');
|
|
43
|
-
expect(props.onClose).toBeCalledTimes(1);
|
|
44
|
-
expect(props.onConfirm).toBeCalledTimes(1);
|
|
60
|
+
setUp();
|
|
61
|
+
expect(screen.queryByRole('button', { name: 'Yes' })).toBeInTheDocument();
|
|
62
|
+
expect(screen.queryByRole('button', { name: 'No' })).toBeInTheDocument();
|
|
63
|
+
expect(screen.queryByText('Are you sure you want to delete this?')).toBeInTheDocument();
|
|
45
64
|
});
|
|
65
|
+
it('should call props.onClose when click "No" button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var _a, user, onConfirm, onClose;
|
|
67
|
+
return __generator(this, function (_b) {
|
|
68
|
+
switch (_b.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
_a = setUp(), user = _a.user, onConfirm = _a.onConfirm, onClose = _a.onClose;
|
|
71
|
+
return [4 /*yield*/, user.click(screen.getByRole('button', { name: 'No' }))];
|
|
72
|
+
case 1:
|
|
73
|
+
_b.sent();
|
|
74
|
+
expect(onClose).toHaveBeenCalledTimes(1);
|
|
75
|
+
expect(onConfirm).not.toHaveBeenCalled();
|
|
76
|
+
return [2 /*return*/];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}); });
|
|
80
|
+
it('should call props.onConfirm and props.onClose when click "Yes" button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
+
var _a, user, onConfirm, onClose;
|
|
82
|
+
return __generator(this, function (_b) {
|
|
83
|
+
switch (_b.label) {
|
|
84
|
+
case 0:
|
|
85
|
+
_a = setUp(), user = _a.user, onConfirm = _a.onConfirm, onClose = _a.onClose;
|
|
86
|
+
return [4 /*yield*/, user.click(screen.getByRole('button', { name: 'Yes' }))];
|
|
87
|
+
case 1:
|
|
88
|
+
_b.sent();
|
|
89
|
+
expect(onClose).toHaveBeenCalledTimes(1);
|
|
90
|
+
expect(onConfirm).toHaveBeenCalledTimes(1);
|
|
91
|
+
return [2 /*return*/];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); });
|
|
46
95
|
});
|