@reltio/components 1.4.2027 → 1.4.2029
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/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +0 -1
- package/cjs/features/graph/SigmaGraphContainer/SigmaGraphContainer.test.js +5 -14
- package/cjs/features/graph/SigmaGraphResizer/SigmaGraphResizer.test.js +11 -9
- package/cjs/features/graph/ZoomSlider/ZoomSlider.js +2 -2
- package/cjs/features/graph/ZoomSlider/ZoomSlider.test.js +85 -37
- package/cjs/features/history/DateRangeSelector/DateRangeSelector.specs.js +188 -117
- package/cjs/features/history/HistoryFilterButton/HistoryFilterButton.js +1 -1
- package/cjs/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.specs.js +38 -41
- package/cjs/features/history/HistoryGraph/components/HistoryLink/HistoryLink.specs.js +17 -16
- package/cjs/features/history/HistoryHeader/HistoryHeader.spec.js +21 -31
- package/cjs/features/history/HistoryPanelEmptyState/HistoryPanelEmptyState.specs.js +4 -9
- package/cjs/features/history/HistoryRow/HistoryRow.js +1 -1
- package/cjs/features/history/HistoryRow/HistoryRow.specs.js +74 -34
- package/cjs/features/history/HistoryTree/HistoryTree.js +1 -1
- package/cjs/features/history/HistoryView/HistoryView.specs.js +77 -43
- package/cjs/features/workflow/AddWorkflowButton/AddWorkflowButton.spec.js +83 -34
- package/cjs/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +20 -0
- package/cjs/features/workflow/AttributesChanges/AttributesChanges.js +1 -1
- package/cjs/features/workflow/AttributesChanges/components/ChangeView/ChangeView.js +1 -1
- package/cjs/features/workflow/AttributesChanges/components/ShowMoreLink/ShowMoreLink.spec.js +81 -24
- package/cjs/features/workflow/DueDateField/DueDateField.spec.js +51 -102
- package/cjs/features/workflow/PrioritySelector/PrioritySelector.spec.js +62 -133
- package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +438 -124
- package/cjs/features/workflow/hooks/useChangeRequest.specs.js +17 -27
- package/cjs/features/workflow/hooks/useWorkflowColor.specs.js +23 -47
- package/cjs/features/workflow/hooks/useWorkflowDefinitions.js +5 -1
- package/features/crosswalks/CrosswalkRow/DndCrosswalkRow.test.js +0 -1
- package/features/graph/SigmaGraphContainer/SigmaGraphContainer.test.js +5 -14
- package/features/graph/SigmaGraphResizer/SigmaGraphResizer.test.js +11 -9
- package/features/graph/ZoomSlider/ZoomSlider.js +2 -2
- package/features/graph/ZoomSlider/ZoomSlider.test.js +85 -37
- package/features/history/DateRangeSelector/DateRangeSelector.specs.js +188 -117
- package/features/history/HistoryFilterButton/HistoryFilterButton.js +1 -1
- package/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.specs.js +38 -41
- package/features/history/HistoryGraph/components/HistoryLink/HistoryLink.specs.js +17 -16
- package/features/history/HistoryHeader/HistoryHeader.spec.js +21 -31
- package/features/history/HistoryPanelEmptyState/HistoryPanelEmptyState.specs.js +4 -9
- package/features/history/HistoryRow/HistoryRow.js +1 -1
- package/features/history/HistoryRow/HistoryRow.specs.js +74 -34
- package/features/history/HistoryTree/HistoryTree.js +1 -1
- package/features/history/HistoryView/HistoryView.specs.js +77 -43
- package/features/workflow/AddWorkflowButton/AddWorkflowButton.spec.js +83 -34
- package/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +20 -0
- package/features/workflow/AttributesChanges/AttributesChanges.js +1 -1
- package/features/workflow/AttributesChanges/components/ChangeView/ChangeView.js +1 -1
- package/features/workflow/AttributesChanges/components/ShowMoreLink/ShowMoreLink.spec.js +81 -24
- package/features/workflow/DueDateField/DueDateField.spec.js +51 -102
- package/features/workflow/PrioritySelector/PrioritySelector.spec.js +62 -133
- package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +439 -125
- package/features/workflow/hooks/useChangeRequest.specs.js +17 -24
- package/features/workflow/hooks/useWorkflowColor.specs.js +23 -44
- package/features/workflow/hooks/useWorkflowDefinitions.js +5 -1
- package/package.json +1 -1
- package/cjs/features/workflow/AttributesChanges/AttributesChanges.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/AttributesChanges.spec.js +0 -249
- package/cjs/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.js +0 -44
- package/cjs/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.js +0 -38
- package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.d.ts +0 -1
- package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.js +0 -218
- package/features/workflow/AttributesChanges/AttributesChanges.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/AttributesChanges.spec.js +0 -244
- package/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/components/ChangeView/ChangeView.spec.js +0 -39
- package/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/components/DCRChangesList/DCRChangesList.spec.js +0 -33
- package/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.d.ts +0 -1
- package/features/workflow/AttributesChanges/components/DiffRenderer/DiffRenderer.spec.js +0 -213
|
@@ -51,10 +51,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
var react_1 = __importDefault(require("react"));
|
|
54
|
-
var
|
|
55
|
-
var
|
|
54
|
+
var react_2 = require("@testing-library/react");
|
|
55
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
56
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
57
|
-
var DropDownSelector_1 = require("../../../DropDownSelector");
|
|
58
57
|
var WorkflowTasksContext_1 = require("../../../contexts/WorkflowTasksContext");
|
|
59
58
|
var errors_1 = require("../helpers/errors");
|
|
60
59
|
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
@@ -90,9 +89,10 @@ var priority = mdm_sdk_1.WorkflowPriority.medium;
|
|
|
90
89
|
var defaultProps = { taskId: taskId, priority: priority };
|
|
91
90
|
var setUp = function (_a) {
|
|
92
91
|
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
93
|
-
|
|
92
|
+
var user = user_event_1.default.setup();
|
|
93
|
+
return __assign(__assign({}, (0, react_2.render)(react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues },
|
|
94
94
|
react_1.default.createElement(WorkflowTasksContext_1.WorkflowTasksContext.Provider, { value: workflowTaskContextValue },
|
|
95
|
-
react_1.default.createElement(PrioritySelector_1.PrioritySelector, __assign({}, props)))));
|
|
95
|
+
react_1.default.createElement(PrioritySelector_1.PrioritySelector, __assign({}, props)))))), { user: user });
|
|
96
96
|
};
|
|
97
97
|
describe('PrioritySelector tests', function () {
|
|
98
98
|
beforeAll(function () {
|
|
@@ -101,78 +101,50 @@ describe('PrioritySelector tests', function () {
|
|
|
101
101
|
afterEach(function () {
|
|
102
102
|
jest.clearAllMocks();
|
|
103
103
|
});
|
|
104
|
-
it('should render DropDownSelector', function () {
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
120
|
-
label: 'High',
|
|
121
|
-
value: mdm_sdk_1.WorkflowPriority.high
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
label: 'Urgent',
|
|
125
|
-
value: mdm_sdk_1.WorkflowPriority.urgent
|
|
126
|
-
}
|
|
127
|
-
],
|
|
128
|
-
value: {
|
|
129
|
-
label: 'Medium',
|
|
130
|
-
value: priority
|
|
131
|
-
},
|
|
132
|
-
TextFieldProps: { disabled: false }
|
|
104
|
+
it('should render DropDownSelector', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
+
var user;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0:
|
|
109
|
+
user = setUp().user;
|
|
110
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Medium'))];
|
|
111
|
+
case 1:
|
|
112
|
+
_a.sent();
|
|
113
|
+
expect(react_2.screen.getByText('Low')).toBeInTheDocument();
|
|
114
|
+
expect(react_2.screen.getByText('Medium')).toBeInTheDocument();
|
|
115
|
+
expect(react_2.screen.getByText('High')).toBeInTheDocument();
|
|
116
|
+
expect(react_2.screen.getByText('Urgent')).toBeInTheDocument();
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
133
119
|
});
|
|
134
|
-
});
|
|
120
|
+
}); });
|
|
135
121
|
it('should disable DropDownSelector if user has no permissions to update task', function () {
|
|
136
|
-
var
|
|
122
|
+
var userWithoutPermissions = __assign(__assign({}, defaultUser), { userPermissions: __assign(__assign({}, defaultUser.userPermissions), { permissions: {
|
|
137
123
|
'workflow:data.tasks': {
|
|
138
124
|
READ: ['otherTenant']
|
|
139
125
|
}
|
|
140
126
|
} }) });
|
|
141
|
-
var mdmValues = __assign(__assign({}, defaultMdmValues), { user:
|
|
142
|
-
|
|
143
|
-
expect(
|
|
144
|
-
expect(component.find(DropDownSelector_1.DropDownSelector).props()).toMatchObject({
|
|
145
|
-
isDisabled: true,
|
|
146
|
-
TextFieldProps: { disabled: true }
|
|
147
|
-
});
|
|
127
|
+
var mdmValues = __assign(__assign({}, defaultMdmValues), { user: userWithoutPermissions });
|
|
128
|
+
setUp({ mdmValues: mdmValues });
|
|
129
|
+
expect(react_2.screen.getByRole('combobox')).toBeDisabled();
|
|
148
130
|
});
|
|
149
131
|
it('should disable DropDownSelector if task is closed', function () {
|
|
150
132
|
var props = __assign(__assign({}, defaultProps), { isTaskOpen: false });
|
|
151
|
-
|
|
152
|
-
expect(
|
|
153
|
-
expect(component.find(DropDownSelector_1.DropDownSelector).props()).toMatchObject({
|
|
154
|
-
isDisabled: true,
|
|
155
|
-
TextFieldProps: { disabled: true }
|
|
156
|
-
});
|
|
133
|
+
setUp({ props: props });
|
|
134
|
+
expect(react_2.screen.getByRole('combobox')).toBeDisabled();
|
|
157
135
|
});
|
|
158
|
-
it('should update task on API and UI side on
|
|
159
|
-
var
|
|
136
|
+
it('should update task on API and UI side on change priority', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
137
|
+
var user;
|
|
160
138
|
return __generator(this, function (_a) {
|
|
161
139
|
switch (_a.label) {
|
|
162
140
|
case 0:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
});
|
|
171
|
-
component.update();
|
|
172
|
-
expect(component.find(DropDownSelector_1.DropDownSelector).props()).toMatchObject({
|
|
173
|
-
isDisabled: true,
|
|
174
|
-
TextFieldProps: { disabled: true }
|
|
175
|
-
});
|
|
141
|
+
user = setUp().user;
|
|
142
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Medium'))];
|
|
143
|
+
case 1:
|
|
144
|
+
_a.sent();
|
|
145
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Urgent'))];
|
|
146
|
+
case 2:
|
|
147
|
+
_a.sent();
|
|
176
148
|
expect(mdm_sdk_1.updatePriorityForTask).toHaveBeenCalledWith({
|
|
177
149
|
workflowPath: workflowPath,
|
|
178
150
|
environment: workflowEnvironmentUrl,
|
|
@@ -180,64 +152,42 @@ describe('PrioritySelector tests', function () {
|
|
|
180
152
|
taskId: taskId,
|
|
181
153
|
priority: mdm_sdk_1.WorkflowPriority.urgent
|
|
182
154
|
});
|
|
183
|
-
return [4 /*yield*/, (0, test_utils_1.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
184
|
-
return __generator(this, function (_a) {
|
|
185
|
-
switch (_a.label) {
|
|
186
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
187
|
-
case 1:
|
|
188
|
-
_a.sent();
|
|
189
|
-
return [2 /*return*/];
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}); })];
|
|
193
|
-
case 1:
|
|
194
|
-
_a.sent();
|
|
195
|
-
component.update();
|
|
196
155
|
expect(updateTaskState).toHaveBeenCalledWith(taskId, { priority: mdm_sdk_1.WorkflowPriority.urgent });
|
|
197
|
-
expect(component.find(DropDownSelector_1.DropDownSelector).props()).toMatchObject({
|
|
198
|
-
isDisabled: false,
|
|
199
|
-
TextFieldProps: { disabled: false }
|
|
200
|
-
});
|
|
201
156
|
return [2 /*return*/];
|
|
202
157
|
}
|
|
203
158
|
});
|
|
204
159
|
}); });
|
|
205
|
-
it('should do nothing in case of updating with previous value', function () {
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
160
|
+
it('should do nothing in case of updating with previous value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
161
|
+
var user;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0:
|
|
165
|
+
user = setUp().user;
|
|
166
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Medium'))];
|
|
167
|
+
case 1:
|
|
168
|
+
_a.sent();
|
|
169
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Medium'))];
|
|
170
|
+
case 2:
|
|
171
|
+
_a.sent();
|
|
172
|
+
expect(mdm_sdk_1.updatePriorityForTask).not.toHaveBeenCalled();
|
|
173
|
+
expect(updateTaskState).not.toHaveBeenCalled();
|
|
174
|
+
return [2 /*return*/];
|
|
175
|
+
}
|
|
218
176
|
});
|
|
219
|
-
|
|
220
|
-
expect(updateTaskState).not.toHaveBeenCalled();
|
|
221
|
-
});
|
|
177
|
+
}); });
|
|
222
178
|
it('should show error if update request was unsuccessful', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
-
var
|
|
179
|
+
var user;
|
|
224
180
|
return __generator(this, function (_a) {
|
|
225
181
|
switch (_a.label) {
|
|
226
182
|
case 0:
|
|
227
|
-
mdm_sdk_1.updatePriorityForTask.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
component.update();
|
|
237
|
-
expect(component.find(DropDownSelector_1.DropDownSelector).props()).toMatchObject({
|
|
238
|
-
isDisabled: true,
|
|
239
|
-
TextFieldProps: { disabled: true }
|
|
240
|
-
});
|
|
183
|
+
mdm_sdk_1.updatePriorityForTask.mockRejectedValue('error!');
|
|
184
|
+
user = setUp().user;
|
|
185
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Medium'))];
|
|
186
|
+
case 1:
|
|
187
|
+
_a.sent();
|
|
188
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Urgent'))];
|
|
189
|
+
case 2:
|
|
190
|
+
_a.sent();
|
|
241
191
|
expect(mdm_sdk_1.updatePriorityForTask).toHaveBeenCalledWith({
|
|
242
192
|
workflowPath: workflowPath,
|
|
243
193
|
environment: workflowEnvironmentUrl,
|
|
@@ -245,28 +195,7 @@ describe('PrioritySelector tests', function () {
|
|
|
245
195
|
taskId: taskId,
|
|
246
196
|
priority: mdm_sdk_1.WorkflowPriority.urgent
|
|
247
197
|
});
|
|
248
|
-
return [4 /*yield*/, (0, test_utils_1.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
249
|
-
return __generator(this, function (_a) {
|
|
250
|
-
switch (_a.label) {
|
|
251
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
252
|
-
case 1:
|
|
253
|
-
_a.sent();
|
|
254
|
-
return [2 /*return*/];
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
}); })];
|
|
258
|
-
case 1:
|
|
259
|
-
_a.sent();
|
|
260
|
-
component.update();
|
|
261
198
|
expect(updateTaskState).not.toHaveBeenCalled();
|
|
262
|
-
expect(component.find(DropDownSelector_1.DropDownSelector).props()).toMatchObject({
|
|
263
|
-
isDisabled: false,
|
|
264
|
-
TextFieldProps: { disabled: false },
|
|
265
|
-
value: {
|
|
266
|
-
label: 'Medium',
|
|
267
|
-
value: priority
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
199
|
expect(errors_1.showWorkflowError).toHaveBeenCalledWith('error!');
|
|
271
200
|
return [2 /*return*/];
|
|
272
201
|
}
|