@reltio/components 1.4.2188 → 1.4.2190

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.
Files changed (35) hide show
  1. package/AdvancedSearchFabButton/AdvancedSearchFabButton.d.ts +1 -0
  2. package/AdvancedSearchFabButton/AdvancedSearchFabButton.js +2 -2
  3. package/AttributesFiltersButton/AttributesFiltersButton.d.ts +4 -1
  4. package/AttributesFiltersButton/AttributesFiltersButton.js +4 -4
  5. package/Drawer/Drawer.d.ts +1 -6
  6. package/Drawer/Drawer.js +4 -4
  7. package/FacetGroup/FacetGroup.d.ts +2 -1
  8. package/FacetGroup/FacetGroup.js +2 -2
  9. package/FacetsSelector/helpers.d.ts +1 -4
  10. package/QuickFiltersDrawer/QuickFiltersDrawer.d.ts +2 -2
  11. package/QuickFiltersDrawer/QuickFiltersDrawer.js +23 -7
  12. package/QuickFiltersDrawer/QuickFiltersDrawer.module.css.js +2 -2
  13. package/cjs/AdvancedSearchFabButton/AdvancedSearchFabButton.d.ts +1 -0
  14. package/cjs/AdvancedSearchFabButton/AdvancedSearchFabButton.js +2 -2
  15. package/cjs/AttributesFiltersButton/AttributesFiltersButton.d.ts +4 -1
  16. package/cjs/AttributesFiltersButton/AttributesFiltersButton.js +4 -4
  17. package/cjs/Drawer/Drawer.d.ts +1 -6
  18. package/cjs/Drawer/Drawer.js +3 -4
  19. package/cjs/FacetGroup/FacetGroup.d.ts +2 -1
  20. package/cjs/FacetGroup/FacetGroup.js +2 -2
  21. package/cjs/FacetsSelector/helpers.d.ts +1 -4
  22. package/cjs/QuickFiltersDrawer/QuickFiltersDrawer.d.ts +2 -2
  23. package/cjs/QuickFiltersDrawer/QuickFiltersDrawer.js +46 -7
  24. package/cjs/QuickFiltersDrawer/QuickFiltersDrawer.module.css.js +2 -2
  25. package/cjs/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +67 -0
  26. package/cjs/features/workflow/TaskActionButtons/TaskActionButtons.spec.js +1 -1
  27. package/cjs/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +80 -5
  28. package/cjs/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.spec.js +104 -0
  29. package/cjs/features/workflow/WorkflowTaskCard/components/PotentialMatchTaskCard/PotentialMatchTaskCard.spec.js +69 -3
  30. package/features/workflow/AddWorkflowDialog/AddWorkflowDialog.spec.js +67 -0
  31. package/features/workflow/TaskActionButtons/TaskActionButtons.spec.js +1 -1
  32. package/features/workflow/WorkflowTaskCard/components/DataChangeRequestTaskCard/DataChangeRequestTaskCard.spec.js +82 -7
  33. package/features/workflow/WorkflowTaskCard/components/GenericWorkflowTaskCard/GenericWorkflowTaskCard.spec.js +105 -1
  34. package/features/workflow/WorkflowTaskCard/components/PotentialMatchTaskCard/PotentialMatchTaskCard.spec.js +71 -5
  35. package/package.json +1 -1
@@ -57,7 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  import React from 'react';
58
58
  import i18n from 'ui-i18n';
59
59
  import { identity } from 'ramda';
60
- import { render, screen } from '@testing-library/react';
60
+ import { render, screen, within } from '@testing-library/react';
61
61
  import userEvent from '@testing-library/user-event';
62
62
  import { createTheme } from '@mui/material/styles';
63
63
  import { ThemeProvider } from '@mui/styles';
@@ -451,4 +451,108 @@ describe('GenericWorkflowTaskCard tests', function () {
451
451
  }
452
452
  });
453
453
  }); });
454
+ describe('Required comments', function () {
455
+ it('should show comment dialog when user runs action and comment is required', function () { return __awaiter(void 0, void 0, void 0, function () {
456
+ var task, user, dialog, comment, commentInput;
457
+ return __generator(this, function (_a) {
458
+ switch (_a.label) {
459
+ case 0:
460
+ task = __assign(__assign({}, defaultTask), { possibleActions: [
461
+ {
462
+ action: 'Delete',
463
+ label: 'Delete',
464
+ commentRequired: true
465
+ },
466
+ {
467
+ action: 'Cancel',
468
+ label: 'Cancel',
469
+ commentRequired: false
470
+ }
471
+ ] });
472
+ user = setUp({ task: task }).user;
473
+ return [4 /*yield*/, user.click(screen.getByTestId('task-actions'))];
474
+ case 1:
475
+ _a.sent();
476
+ return [4 /*yield*/, user.click(screen.getByText(task.possibleActions[0].label))];
477
+ case 2:
478
+ _a.sent();
479
+ expect(runTaskAction).not.toHaveBeenCalled();
480
+ dialog = screen.getAllByRole('presentation')[1];
481
+ expect(within(dialog).getByText('Please provide a comment for your action')).toBeInTheDocument();
482
+ expect(within(dialog).getByText('Type a comment')).toBeInTheDocument();
483
+ expect(within(dialog).getByText('Cancel')).toBeInTheDocument();
484
+ expect(within(dialog).getByText('Done')).toBeInTheDocument();
485
+ comment = 'comment';
486
+ commentInput = screen.getAllByRole('textbox')[0];
487
+ return [4 /*yield*/, user.click(commentInput)];
488
+ case 3:
489
+ _a.sent();
490
+ return [4 /*yield*/, user.paste(comment)];
491
+ case 4:
492
+ _a.sent();
493
+ return [4 /*yield*/, user.click(within(screen.getAllByRole('presentation')[1]).getByText('Done'))];
494
+ case 5:
495
+ _a.sent();
496
+ expect(runTaskAction).toHaveBeenCalledWith({
497
+ workflowPath: workflowPath,
498
+ environment: workflowEnvironmentUrl,
499
+ tenant: tenant.id,
500
+ taskId: defaultTask.taskId,
501
+ action: defaultTask.possibleActions[0].action,
502
+ processInstanceComment: comment
503
+ });
504
+ return [2 /*return*/];
505
+ }
506
+ });
507
+ }); });
508
+ it('should not show comment dialog when user types comment and run action', function () { return __awaiter(void 0, void 0, void 0, function () {
509
+ var task, user, comment, commentInput;
510
+ var _a;
511
+ return __generator(this, function (_b) {
512
+ switch (_b.label) {
513
+ case 0:
514
+ task = __assign(__assign({}, defaultTask), { possibleActions: [
515
+ {
516
+ action: 'Delete',
517
+ label: 'Delete',
518
+ commentRequired: true
519
+ },
520
+ {
521
+ action: 'Cancel',
522
+ label: 'Cancel',
523
+ commentRequired: false
524
+ }
525
+ ] });
526
+ user = setUp({ task: task }).user;
527
+ return [4 /*yield*/, user.click(screen.getByTestId('collapse-button'))];
528
+ case 1:
529
+ _b.sent();
530
+ comment = 'comment';
531
+ commentInput = screen.getByPlaceholderText('Write a comment');
532
+ return [4 /*yield*/, user.click(commentInput)];
533
+ case 2:
534
+ _b.sent();
535
+ return [4 /*yield*/, user.paste(comment)];
536
+ case 3:
537
+ _b.sent();
538
+ return [4 /*yield*/, user.click(screen.getByRole('button', { name: (_a = task.preferredAction) === null || _a === void 0 ? void 0 : _a.label }))];
539
+ case 4:
540
+ _b.sent();
541
+ return [4 /*yield*/, user.click(screen.getByTestId("reltio-profile-select-mode-".concat(task.possibleActions[0].label)))];
542
+ case 5:
543
+ _b.sent();
544
+ expect(screen.queryByText('Please provide a comment for your action')).not.toBeInTheDocument();
545
+ expect(runTaskAction).toHaveBeenCalledWith({
546
+ workflowPath: workflowPath,
547
+ environment: workflowEnvironmentUrl,
548
+ tenant: tenant.id,
549
+ taskId: defaultTask.taskId,
550
+ action: defaultTask.possibleActions[0].action,
551
+ processInstanceComment: comment
552
+ });
553
+ return [2 /*return*/];
554
+ }
555
+ });
556
+ }); });
557
+ });
454
558
  });
@@ -46,25 +46,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  }
47
47
  };
48
48
  import React from 'react';
49
- import { render, screen } from '@testing-library/react';
49
+ import { render, screen, within } from '@testing-library/react';
50
50
  import userEvent from '@testing-library/user-event';
51
- import { ActivityFilter } from '@reltio/mdm-sdk';
51
+ import { ActivityFilter, runTaskAction } from '@reltio/mdm-sdk';
52
52
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
53
53
  import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
54
54
  import { MdmModuleProvider } from '../../../../../contexts/MdmModuleContext';
55
55
  import { CommentDialogProvider } from '../../../../../contexts/CommentDialogContext';
56
56
  import { PotentialMatchTaskCard } from './PotentialMatchTaskCard';
57
+ jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { runTaskAction: jest.fn() })); });
57
58
  describe('PotentialMatchTaskCard tests', function () {
59
+ var tenant = { id: 't1', name: 't1' };
60
+ var workflowPath = 'workflowPath';
61
+ var workflowEnvironmentUrl = 'workflowEnvironmentUrl';
58
62
  var mdmValues = {
59
63
  metadata: { entityTypes: [], relationTypes: [] },
60
64
  entity: { uri: 'entities/uri1', type: 'configuration/entityTypes/HCO' },
61
- tenant: { id: 't1', name: 't1' },
65
+ tenant: tenant,
66
+ workflowPath: workflowPath,
67
+ workflowEnvironmentUrl: workflowEnvironmentUrl,
68
+ user: { username: 'egorshkov' },
62
69
  dtssPath: 'path',
63
70
  dataTenants: [],
64
71
  activityFilter: ActivityFilter.ACTIVE_ONLY
65
72
  };
66
73
  var relatedEntityUri = 'entities/6hj8baQ';
67
- var task = {
74
+ var defaultTask = {
68
75
  assignee: 'egorshkov',
69
76
  objectURIs: [relatedEntityUri, 'entities/1RdgehCi'],
70
77
  createdBy: 'egorshkov',
@@ -98,7 +105,7 @@ describe('PotentialMatchTaskCard tests', function () {
98
105
  uri: 'entities/6hj8baQ'
99
106
  }
100
107
  };
101
- var defaultProps = { task: task, match: match, entitiesMap: entitiesMap };
108
+ var defaultProps = { task: defaultTask, match: match, entitiesMap: entitiesMap };
102
109
  var setUp = function (props) {
103
110
  if (props === void 0) { props = {}; }
104
111
  var user = userEvent.setup();
@@ -110,6 +117,9 @@ describe('PotentialMatchTaskCard tests', function () {
110
117
  };
111
118
  return __assign({ user: user }, render(React.createElement(PotentialMatchTaskCard, __assign({}, defaultProps, props)), { wrapper: Providers }));
112
119
  };
120
+ beforeAll(function () {
121
+ runTaskAction.mockResolvedValue(null);
122
+ });
113
123
  afterEach(function () {
114
124
  jest.clearAllMocks();
115
125
  });
@@ -158,4 +168,60 @@ describe('PotentialMatchTaskCard tests', function () {
158
168
  }
159
169
  });
160
170
  }); });
171
+ describe('Required comments', function () {
172
+ it('should show comment dialog when user runs action and comment is required', function () { return __awaiter(void 0, void 0, void 0, function () {
173
+ var task, user, dialog, comment, commentInput;
174
+ return __generator(this, function (_a) {
175
+ switch (_a.label) {
176
+ case 0:
177
+ task = __assign(__assign({}, defaultTask), { isOpen: true, possibleActions: [
178
+ {
179
+ action: 'Approve',
180
+ label: 'Approve',
181
+ commentRequired: true
182
+ },
183
+ {
184
+ action: 'Reject',
185
+ label: 'Reject',
186
+ commentRequired: false
187
+ }
188
+ ] });
189
+ user = setUp({ task: task }).user;
190
+ return [4 /*yield*/, user.click(screen.getByTestId('task-actions'))];
191
+ case 1:
192
+ _a.sent();
193
+ return [4 /*yield*/, user.click(screen.getByText(task.possibleActions[0].label))];
194
+ case 2:
195
+ _a.sent();
196
+ expect(runTaskAction).not.toHaveBeenCalled();
197
+ dialog = screen.getAllByRole('presentation')[1];
198
+ expect(within(dialog).getByText('Please provide a comment for your action')).toBeInTheDocument();
199
+ expect(within(dialog).getByText('Type a comment')).toBeInTheDocument();
200
+ expect(within(dialog).getByText('Cancel')).toBeInTheDocument();
201
+ expect(within(dialog).getByText('Done')).toBeInTheDocument();
202
+ comment = 'Some comment';
203
+ commentInput = screen.getAllByRole('textbox')[0];
204
+ return [4 /*yield*/, user.click(commentInput)];
205
+ case 3:
206
+ _a.sent();
207
+ return [4 /*yield*/, user.paste(comment)];
208
+ case 4:
209
+ _a.sent();
210
+ return [4 /*yield*/, user.click(within(dialog).getByText('Done'))];
211
+ case 5:
212
+ _a.sent();
213
+ expect(screen.queryByText('Please provide a comment for your action')).not.toBeInTheDocument();
214
+ expect(runTaskAction).toHaveBeenCalledWith({
215
+ workflowPath: workflowPath,
216
+ environment: workflowEnvironmentUrl,
217
+ tenant: tenant.id,
218
+ taskId: task.taskId,
219
+ action: task.possibleActions[0].action,
220
+ processInstanceComment: comment
221
+ });
222
+ return [2 /*return*/];
223
+ }
224
+ });
225
+ }); });
226
+ });
161
227
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2188",
3
+ "version": "1.4.2190",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",