@reltio/components 1.4.2026 → 1.4.2028
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/RCTree/styles.js +4 -1
- package/cjs/RCTree/styles.js +4 -1
- 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/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/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/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/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
|
@@ -9,14 +9,48 @@ 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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
import React from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
49
|
+
import { render, screen } from '@testing-library/react';
|
|
50
|
+
import userEvent from '@testing-library/user-event';
|
|
51
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
52
|
+
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
|
|
15
53
|
import { DateRangeTypes } from '@reltio/mdm-sdk';
|
|
16
|
-
import Typography from '@mui/material/Typography';
|
|
17
|
-
import { DateIntervalSelector } from '../../../DateIntervalSelector';
|
|
18
|
-
import { CustomDateRangeEditor } from '../../../CustomDateRangeEditor';
|
|
19
|
-
import { SimpleDropDownSelector } from '../../../SimpleDropDownSelector';
|
|
20
54
|
import { DateRangeSelector } from './DateRangeSelector';
|
|
21
55
|
describe('DateRangeSelector tests', function () {
|
|
22
56
|
var withinValue = {
|
|
@@ -25,136 +59,173 @@ describe('DateRangeSelector tests', function () {
|
|
|
25
59
|
};
|
|
26
60
|
var agoValue = {
|
|
27
61
|
type: DateRangeTypes.AGO,
|
|
28
|
-
period: [4, '
|
|
62
|
+
period: [4, 'months']
|
|
29
63
|
};
|
|
30
64
|
var betweenValue = {
|
|
31
65
|
type: DateRangeTypes.BETWEEN,
|
|
32
|
-
period: [new Date(
|
|
66
|
+
period: [new Date('01/01/2023'), new Date('01/01/2024')]
|
|
33
67
|
};
|
|
34
68
|
var defaultProps = {
|
|
35
69
|
onChange: jest.fn(),
|
|
36
|
-
className: 'someclass'
|
|
70
|
+
className: 'someclass',
|
|
71
|
+
value: withinValue
|
|
72
|
+
};
|
|
73
|
+
var setUp = function (props) {
|
|
74
|
+
if (props === void 0) { props = defaultProps; }
|
|
75
|
+
var user = userEvent.setup();
|
|
76
|
+
var Providers = function (_a) {
|
|
77
|
+
var children = _a.children;
|
|
78
|
+
return React.createElement(LocalizationProvider, { dateAdapter: AdapterMoment }, children);
|
|
79
|
+
};
|
|
80
|
+
return __assign(__assign({}, render(React.createElement(DateRangeSelector, __assign({}, props)), { wrapper: Providers })), { user: user });
|
|
37
81
|
};
|
|
38
|
-
var options = [
|
|
39
|
-
{ value: DateRangeTypes.WITHIN, label: 'Within the last' },
|
|
40
|
-
{ value: DateRangeTypes.AGO, label: 'More than' },
|
|
41
|
-
{ value: DateRangeTypes.BETWEEN, label: 'Date range' }
|
|
42
|
-
];
|
|
43
|
-
afterEach(function () {
|
|
44
|
-
jest.clearAllMocks();
|
|
45
|
-
});
|
|
46
82
|
it('should render correct default state if props.value type is DateRangeTypes.WITHIN', function () {
|
|
47
|
-
|
|
48
|
-
expect(
|
|
49
|
-
|
|
50
|
-
expect(
|
|
51
|
-
expect(
|
|
52
|
-
value: {
|
|
53
|
-
value: options[0].value,
|
|
54
|
-
label: options[0].label
|
|
55
|
-
},
|
|
56
|
-
options: options
|
|
57
|
-
});
|
|
58
|
-
expect(wrapper.find(DateIntervalSelector).prop('interval')).toEqual(withinValue.period);
|
|
59
|
-
expect(wrapper.find(CustomDateRangeEditor).length).toBe(0);
|
|
83
|
+
setUp();
|
|
84
|
+
expect(screen.getByText('Date')).toBeInTheDocument();
|
|
85
|
+
expect(screen.getByText('Within the last')).toBeInTheDocument();
|
|
86
|
+
expect(screen.getByText('Days')).toBeInTheDocument();
|
|
87
|
+
expect(screen.getByDisplayValue('5')).toBeInTheDocument();
|
|
60
88
|
});
|
|
61
89
|
it('should render correct default state if props.value type is DateRangeTypes.AGO', function () {
|
|
62
|
-
|
|
63
|
-
expect(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
expect(wrapper.find(DateIntervalSelector).prop('interval')).toEqual(agoValue.period);
|
|
68
|
-
expect(wrapper.find(CustomDateRangeEditor).length).toBe(0);
|
|
90
|
+
setUp(__assign(__assign({}, defaultProps), { value: agoValue }));
|
|
91
|
+
expect(screen.getByText('Date')).toBeInTheDocument();
|
|
92
|
+
expect(screen.getByText('More than')).toBeInTheDocument();
|
|
93
|
+
expect(screen.getByText('Months')).toBeInTheDocument();
|
|
94
|
+
expect(screen.getByDisplayValue('4')).toBeInTheDocument();
|
|
69
95
|
});
|
|
70
96
|
it('should render correct default state if props.value type is DateRangeTypes.BETWEEN', function () {
|
|
71
|
-
|
|
72
|
-
expect(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
expect(wrapper.find(CustomDateRangeEditor).prop('values')).toEqual(betweenValue.period);
|
|
77
|
-
expect(wrapper.find(DateIntervalSelector).length).toBe(0);
|
|
97
|
+
setUp(__assign(__assign({}, defaultProps), { value: betweenValue }));
|
|
98
|
+
expect(screen.getByText('Date')).toBeInTheDocument();
|
|
99
|
+
expect(screen.getByText('Date range')).toBeInTheDocument();
|
|
100
|
+
expect(screen.getByDisplayValue('01/01/2023 — 01/01/2024')).toBeInTheDocument();
|
|
78
101
|
});
|
|
79
102
|
it('should render proper default value if props.value is null', function () {
|
|
80
|
-
|
|
81
|
-
expect(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
expect(wrapper.find(DateIntervalSelector).prop('interval')).toEqual([null, 'hours']);
|
|
86
|
-
expect(wrapper.find(CustomDateRangeEditor).length).toBe(0);
|
|
103
|
+
setUp(__assign(__assign({}, defaultProps), { value: null }));
|
|
104
|
+
expect(screen.getByText('Date')).toBeInTheDocument();
|
|
105
|
+
expect(screen.getByText('Within the last')).toBeInTheDocument();
|
|
106
|
+
expect(screen.getByText('Hours')).toBeInTheDocument();
|
|
87
107
|
});
|
|
88
|
-
it('should call props.onChange with proper parameters when type is changed to ago', function () {
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
it('should call props.onChange with proper parameters when type is changed to ago', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
109
|
+
var user, newValue;
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
switch (_a.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
user = setUp().user;
|
|
114
|
+
return [4 /*yield*/, user.click(screen.getByText('Within the last'))];
|
|
115
|
+
case 1:
|
|
116
|
+
_a.sent();
|
|
117
|
+
return [4 /*yield*/, user.click(screen.getByText('More than'))];
|
|
118
|
+
case 2:
|
|
119
|
+
_a.sent();
|
|
120
|
+
newValue = {
|
|
121
|
+
type: DateRangeTypes.AGO,
|
|
122
|
+
period: [5, 'days']
|
|
123
|
+
};
|
|
124
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith(newValue);
|
|
125
|
+
return [2 /*return*/];
|
|
126
|
+
}
|
|
92
127
|
});
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
128
|
+
}); });
|
|
129
|
+
it('should call props.onChange with proper parameters when type is changed to within', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
130
|
+
var user, newValue;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
|
+
case 0:
|
|
134
|
+
user = setUp(__assign(__assign({}, defaultProps), { value: betweenValue })).user;
|
|
135
|
+
return [4 /*yield*/, user.click(screen.getByText('Date range'))];
|
|
136
|
+
case 1:
|
|
137
|
+
_a.sent();
|
|
138
|
+
return [4 /*yield*/, user.click(screen.getByText('Within the last'))];
|
|
139
|
+
case 2:
|
|
140
|
+
_a.sent();
|
|
141
|
+
newValue = {
|
|
142
|
+
type: DateRangeTypes.WITHIN,
|
|
143
|
+
period: [null, 'hours']
|
|
144
|
+
};
|
|
145
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith(newValue);
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
}
|
|
104
148
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
149
|
+
}); });
|
|
150
|
+
it('should call props.onChange with proper parameters when type is changed to between', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
|
+
var user, newValue;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
switch (_a.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
user = setUp().user;
|
|
156
|
+
return [4 /*yield*/, user.click(screen.getByText('Within the last'))];
|
|
157
|
+
case 1:
|
|
158
|
+
_a.sent();
|
|
159
|
+
return [4 /*yield*/, user.click(screen.getByText('Date range'))];
|
|
160
|
+
case 2:
|
|
161
|
+
_a.sent();
|
|
162
|
+
newValue = {
|
|
163
|
+
type: DateRangeTypes.BETWEEN,
|
|
164
|
+
period: [null, null]
|
|
165
|
+
};
|
|
166
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith(newValue);
|
|
167
|
+
return [2 /*return*/];
|
|
168
|
+
}
|
|
116
169
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
170
|
+
}); });
|
|
171
|
+
it('should call props.onChange when within period is changed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
+
var user, newValue;
|
|
173
|
+
return __generator(this, function (_a) {
|
|
174
|
+
switch (_a.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
user = setUp().user;
|
|
177
|
+
return [4 /*yield*/, user.type(screen.getByDisplayValue('5'), '1')];
|
|
178
|
+
case 1:
|
|
179
|
+
_a.sent();
|
|
180
|
+
newValue = {
|
|
181
|
+
type: DateRangeTypes.WITHIN,
|
|
182
|
+
period: [51, 'days']
|
|
183
|
+
};
|
|
184
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith(newValue);
|
|
185
|
+
return [2 /*return*/];
|
|
186
|
+
}
|
|
128
187
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
188
|
+
}); });
|
|
189
|
+
it('should call props.onChange when ago period is changed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
+
var user, newValue;
|
|
191
|
+
return __generator(this, function (_a) {
|
|
192
|
+
switch (_a.label) {
|
|
193
|
+
case 0:
|
|
194
|
+
user = setUp(__assign(__assign({}, defaultProps), { value: agoValue })).user;
|
|
195
|
+
return [4 /*yield*/, user.type(screen.getByDisplayValue('4'), '1')];
|
|
196
|
+
case 1:
|
|
197
|
+
_a.sent();
|
|
198
|
+
newValue = {
|
|
199
|
+
type: DateRangeTypes.AGO,
|
|
200
|
+
period: [41, 'months']
|
|
201
|
+
};
|
|
202
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith(newValue);
|
|
203
|
+
return [2 /*return*/];
|
|
204
|
+
}
|
|
140
205
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
206
|
+
}); });
|
|
207
|
+
it('should call props.onChange when between period is changed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
+
var user, newValue;
|
|
209
|
+
return __generator(this, function (_a) {
|
|
210
|
+
switch (_a.label) {
|
|
211
|
+
case 0:
|
|
212
|
+
user = setUp(__assign(__assign({}, defaultProps), { value: betweenValue })).user;
|
|
213
|
+
return [4 /*yield*/, user.click(screen.getByDisplayValue('01/01/2023 — 01/01/2024'))];
|
|
214
|
+
case 1:
|
|
215
|
+
_a.sent();
|
|
216
|
+
return [4 /*yield*/, user.type(screen.getByDisplayValue('01/01/2023'), '01/01/2022')];
|
|
217
|
+
case 2:
|
|
218
|
+
_a.sent();
|
|
219
|
+
return [4 /*yield*/, user.click(screen.getByText('Update'))];
|
|
220
|
+
case 3:
|
|
221
|
+
_a.sent();
|
|
222
|
+
newValue = {
|
|
223
|
+
type: DateRangeTypes.BETWEEN,
|
|
224
|
+
period: [new Date('01/01/2022'), new Date('01/01/2024')]
|
|
225
|
+
};
|
|
226
|
+
expect(defaultProps.onChange).toHaveBeenCalledWith(newValue);
|
|
227
|
+
return [2 /*return*/];
|
|
228
|
+
}
|
|
152
229
|
});
|
|
153
|
-
|
|
154
|
-
var newValue = {
|
|
155
|
-
type: DateRangeTypes.BETWEEN,
|
|
156
|
-
period: [new Date(234), new Date(567)]
|
|
157
|
-
};
|
|
158
|
-
expect(defaultProps.onChange).toHaveBeenCalledWith(newValue);
|
|
159
|
-
});
|
|
230
|
+
}); });
|
|
160
231
|
});
|
|
@@ -63,7 +63,7 @@ export var HistoryFilterButton = function (_a) {
|
|
|
63
63
|
setCurrentValue(__assign({}, DEFAULT_HISTORY_FILTER));
|
|
64
64
|
}, []);
|
|
65
65
|
return (React.createElement(React.Fragment, null,
|
|
66
|
-
React.createElement(SmallIconButton, { ref: buttonRef, color: buttonColor, icon: FilterListIcon, size: "L", onClick: togglePopup, className: className }),
|
|
66
|
+
React.createElement(SmallIconButton, { ref: buttonRef, color: buttonColor, icon: FilterListIcon, size: "L", onClick: togglePopup, className: className, "data-reltio-id": "history-filter-button" }),
|
|
67
67
|
React.createElement(Popover, { classes: { paper: styles.popup }, open: isOpen, anchorEl: buttonRef.current, onClose: togglePopup, anchorOrigin: {
|
|
68
68
|
vertical: 'bottom',
|
|
69
69
|
horizontal: 'right'
|
|
@@ -10,11 +10,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { render, screen } from '@testing-library/react';
|
|
14
14
|
import { BUMP_RADIUS, LINE_MARGIN } from './constants';
|
|
15
15
|
import { HistoryCircle } from './HistoryCircle';
|
|
16
16
|
describe('HistoryCircle tests', function () {
|
|
17
|
-
var
|
|
17
|
+
var defaultProps = {
|
|
18
18
|
x: 10,
|
|
19
19
|
y: 15,
|
|
20
20
|
color: '#FFFAAA',
|
|
@@ -23,56 +23,53 @@ describe('HistoryCircle tests', function () {
|
|
|
23
23
|
showCollapseIcon: false,
|
|
24
24
|
showLine: false
|
|
25
25
|
};
|
|
26
|
+
var setUp = function (props) {
|
|
27
|
+
if (props === void 0) { props = defaultProps; }
|
|
28
|
+
return render(React.createElement(HistoryCircle, __assign({}, props)));
|
|
29
|
+
};
|
|
26
30
|
it('should render correctly', function () {
|
|
27
|
-
var
|
|
28
|
-
expect(
|
|
29
|
-
expect(
|
|
30
|
-
expect(
|
|
31
|
-
var circle =
|
|
32
|
-
expect(circle
|
|
33
|
-
expect(circle.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
strokeDasharray: undefined,
|
|
39
|
-
strokeWidth: 2
|
|
40
|
-
});
|
|
31
|
+
var container = setUp().container;
|
|
32
|
+
expect(container.querySelectorAll('g')).toHaveLength(1);
|
|
33
|
+
expect(container.querySelector('#line')).not.toBeInTheDocument();
|
|
34
|
+
expect(container.querySelector('#icon')).not.toBeInTheDocument();
|
|
35
|
+
var circle = container.querySelector('circle');
|
|
36
|
+
expect(circle).toHaveAttribute('cx', "".concat(defaultProps.x));
|
|
37
|
+
expect(circle).toHaveAttribute('cy', "".concat(defaultProps.y));
|
|
38
|
+
expect(circle).toHaveAttribute('r', "".concat(BUMP_RADIUS));
|
|
39
|
+
expect(circle).toHaveAttribute('fill', defaultProps.color);
|
|
40
|
+
expect(circle).toHaveAttribute('stroke-width', '2');
|
|
41
|
+
expect(circle).not.toHaveAttribute('stroke-dasharray');
|
|
41
42
|
});
|
|
42
43
|
it('should render line above circle if showLine === true', function () {
|
|
43
|
-
var
|
|
44
|
-
var line =
|
|
45
|
-
expect(line
|
|
46
|
-
expect(line.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
height: 2,
|
|
51
|
-
fill: props.color
|
|
52
|
-
});
|
|
44
|
+
var container = setUp(__assign(__assign({}, defaultProps), { showLine: true })).container;
|
|
45
|
+
var line = container.querySelector('#line');
|
|
46
|
+
expect(line).toHaveAttribute('x', "".concat(defaultProps.x - BUMP_RADIUS - LINE_MARGIN));
|
|
47
|
+
expect(line).toHaveAttribute('y', "".concat(defaultProps.y - BUMP_RADIUS - LINE_MARGIN));
|
|
48
|
+
expect(line).toHaveAttribute('width', "".concat(BUMP_RADIUS * 2 + LINE_MARGIN * 2));
|
|
49
|
+
expect(line).toHaveAttribute('height', '2');
|
|
50
|
+
expect(line).toHaveAttribute('fill', defaultProps.color);
|
|
53
51
|
});
|
|
54
52
|
it('should render dashed circle if isDashed === true', function () {
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
53
|
+
var container = setUp(__assign(__assign({}, defaultProps), { isDashed: true })).container;
|
|
54
|
+
var circle = container.querySelector('circle');
|
|
55
|
+
expect(circle).toHaveAttribute('fill', '#fff');
|
|
56
|
+
expect(circle).toHaveAttribute('stroke-dasharray', '1,1');
|
|
60
57
|
});
|
|
61
58
|
it('should render collapse icon if showCollapseIcon === true', function () {
|
|
62
|
-
var
|
|
63
|
-
var icon =
|
|
64
|
-
expect(icon
|
|
65
|
-
expect(icon.
|
|
59
|
+
var container = setUp(__assign(__assign({}, defaultProps), { showCollapseIcon: true })).container;
|
|
60
|
+
var icon = container.querySelector('#icon');
|
|
61
|
+
expect(icon).toBeInTheDocument();
|
|
62
|
+
expect(icon.querySelectorAll('rect')).toHaveLength(1);
|
|
66
63
|
});
|
|
67
64
|
it('should render expand icon if showCollapseIcon === true and isCollapsed === true', function () {
|
|
68
|
-
var
|
|
69
|
-
var icon =
|
|
70
|
-
expect(icon
|
|
71
|
-
expect(icon.
|
|
65
|
+
var container = setUp(__assign(__assign({}, defaultProps), { showCollapseIcon: true, isCollapsed: true })).container;
|
|
66
|
+
var icon = container.querySelector('#icon');
|
|
67
|
+
expect(icon).toBeInTheDocument();
|
|
68
|
+
expect(icon.querySelectorAll('rect')).toHaveLength(2);
|
|
72
69
|
});
|
|
73
70
|
it('should pass rest props to root element', function () {
|
|
74
71
|
var svgProps = { className: 'history-circle' };
|
|
75
|
-
|
|
76
|
-
expect(
|
|
72
|
+
setUp(__assign(__assign({}, defaultProps), svgProps));
|
|
73
|
+
expect(screen.getByTestId('history-circle')).toHaveAttribute('class', svgProps.className);
|
|
77
74
|
});
|
|
78
75
|
});
|
|
@@ -10,11 +10,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { render } from '@testing-library/react';
|
|
14
14
|
import * as helpers from '../../helpers';
|
|
15
15
|
import { HistoryLink } from './HistoryLink';
|
|
16
16
|
describe('HistoryLink tests', function () {
|
|
17
|
-
var
|
|
17
|
+
var defaultProps = {
|
|
18
18
|
x: 10,
|
|
19
19
|
y: 15,
|
|
20
20
|
toX: 20,
|
|
@@ -26,22 +26,23 @@ describe('HistoryLink tests', function () {
|
|
|
26
26
|
beforeAll(function () {
|
|
27
27
|
jest.clearAllMocks();
|
|
28
28
|
});
|
|
29
|
+
var setUp = function (props) {
|
|
30
|
+
if (props === void 0) { props = defaultProps; }
|
|
31
|
+
return render(React.createElement(HistoryLink, __assign({}, props)));
|
|
32
|
+
};
|
|
29
33
|
it('should render correctly', function () {
|
|
30
|
-
var
|
|
31
|
-
expect(getHistoryLinkCurveSpy).toHaveBeenCalledWith(
|
|
32
|
-
|
|
33
|
-
expect(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
strokeDasharray: undefined
|
|
39
|
-
});
|
|
34
|
+
var container = setUp().container;
|
|
35
|
+
expect(getHistoryLinkCurveSpy).toHaveBeenCalledWith(defaultProps.x, defaultProps.y, defaultProps.toX, defaultProps.toY);
|
|
36
|
+
var path = container.querySelector('path');
|
|
37
|
+
expect(path).toHaveAttribute('d', getHistoryLinkCurveSpy.mock.results[0].value);
|
|
38
|
+
expect(path).toHaveAttribute('stroke', defaultProps.color);
|
|
39
|
+
expect(path).toHaveAttribute('fill', 'none');
|
|
40
|
+
expect(path).toHaveAttribute('stroke-width', '2');
|
|
41
|
+
expect(path).not.toHaveAttribute('stroke-dasharray');
|
|
40
42
|
});
|
|
41
43
|
it('should render dashed path if isDashed === true', function () {
|
|
42
|
-
var
|
|
43
|
-
expect(getHistoryLinkCurveSpy).toHaveBeenCalledWith(
|
|
44
|
-
expect(
|
|
45
|
-
expect(wrapper.find('path').prop('strokeDasharray')).toBe('3,3');
|
|
44
|
+
var container = setUp(__assign(__assign({}, defaultProps), { isDashed: true })).container;
|
|
45
|
+
expect(getHistoryLinkCurveSpy).toHaveBeenCalledWith(defaultProps.x, defaultProps.y, defaultProps.toX, defaultProps.toY);
|
|
46
|
+
expect(container.querySelector('path')).toHaveAttribute('stroke-dasharray', '3,3');
|
|
46
47
|
});
|
|
47
48
|
});
|
|
@@ -10,12 +10,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { render, screen } from '@testing-library/react';
|
|
14
14
|
import { DateRangeTypes } from '@reltio/mdm-sdk';
|
|
15
|
-
import Divider from '@mui/material/Divider';
|
|
16
|
-
import Typography from '@mui/material/Typography';
|
|
17
|
-
import { HistoryFilterButton } from '../HistoryFilterButton';
|
|
18
|
-
import { HistoryMenuButton } from '../HistoryMenuButton';
|
|
19
15
|
import { HistoryActivityType } from '../types';
|
|
20
16
|
import { HistoryHeader } from './HistoryHeader';
|
|
21
17
|
describe('HistoryHeader tests', function () {
|
|
@@ -28,7 +24,7 @@ describe('HistoryHeader tests', function () {
|
|
|
28
24
|
activities: [HistoryActivityType.UPDATE, HistoryActivityType.UNMERGE],
|
|
29
25
|
attributes: []
|
|
30
26
|
};
|
|
31
|
-
var
|
|
27
|
+
var defaultProps = {
|
|
32
28
|
filter: filter,
|
|
33
29
|
onApplyFilter: jest.fn(),
|
|
34
30
|
onClearFilter: jest.fn(),
|
|
@@ -36,38 +32,32 @@ describe('HistoryHeader tests', function () {
|
|
|
36
32
|
uri: 'configuration/entityTypes/HCA',
|
|
37
33
|
label: 'HCA',
|
|
38
34
|
attributes: []
|
|
39
|
-
}
|
|
35
|
+
},
|
|
36
|
+
total: 5
|
|
37
|
+
};
|
|
38
|
+
var setUp = function (props) {
|
|
39
|
+
if (props === void 0) { props = defaultProps; }
|
|
40
|
+
return render(React.createElement(HistoryHeader, __assign({}, props)));
|
|
40
41
|
};
|
|
41
42
|
it('should render correctly', function () {
|
|
42
|
-
|
|
43
|
-
expect(
|
|
44
|
-
expect(
|
|
45
|
-
expect(
|
|
46
|
-
expect(
|
|
47
|
-
expect(wrapper.find(HistoryFilterButton).props()).toMatchObject({
|
|
48
|
-
entityType: props.entityType,
|
|
49
|
-
filter: props.filter,
|
|
50
|
-
onApplyFilter: props.onApplyFilter
|
|
51
|
-
});
|
|
52
|
-
expect(wrapper.find(HistoryMenuButton)).toHaveLength(1);
|
|
43
|
+
setUp();
|
|
44
|
+
expect(screen.getByText('History')).toBeInTheDocument();
|
|
45
|
+
expect(screen.getByText('5 contributing profiles')).toBeInTheDocument();
|
|
46
|
+
expect(screen.getByTestId('drop-down-menu-button')).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByTestId('history-filter-button')).toBeInTheDocument();
|
|
53
48
|
});
|
|
54
49
|
it('should render correctly for 0 profiles', function () {
|
|
55
|
-
|
|
56
|
-
expect(
|
|
50
|
+
setUp(__assign(__assign({}, defaultProps), { total: 0 }));
|
|
51
|
+
expect(screen.getByText('0 contributing profiles')).toBeInTheDocument();
|
|
57
52
|
});
|
|
58
53
|
it('should render empty state', function () {
|
|
59
|
-
|
|
60
|
-
expect(
|
|
61
|
-
expect(
|
|
62
|
-
expect(
|
|
63
|
-
expect(wrapper.find(HistoryMenuButton)).toHaveLength(1);
|
|
54
|
+
setUp(__assign(__assign({}, defaultProps), { total: undefined }));
|
|
55
|
+
expect(screen.queryByText(/^\d+\scontributing\sprofile(s)?$/)).not.toBeInTheDocument();
|
|
56
|
+
expect(screen.getByTestId('drop-down-menu-button')).toBeInTheDocument();
|
|
57
|
+
expect(screen.getByTestId('history-filter-button')).toBeInTheDocument();
|
|
64
58
|
});
|
|
65
59
|
it('should render correctly for 1 profile', function () {
|
|
66
|
-
|
|
67
|
-
expect(
|
|
68
|
-
});
|
|
69
|
-
it('should render correctly for undefined total', function () {
|
|
70
|
-
var wrapper = shallow(React.createElement(HistoryHeader, __assign({}, props, { total: undefined })));
|
|
71
|
-
expect(wrapper.find('.count')).toHaveLength(0);
|
|
60
|
+
setUp(__assign(__assign({}, defaultProps), { total: 1 }));
|
|
61
|
+
expect(screen.getByText('1 contributing profile')).toBeInTheDocument();
|
|
72
62
|
});
|
|
73
63
|
});
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { SidePanelEmptyState } from '../../../SidePanelEmptyState';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
4
3
|
import { HistoryPanelEmptyState } from './HistoryPanelEmptyState';
|
|
5
4
|
describe('HistoryPanelEmptyState tests', function () {
|
|
6
5
|
it('should render correct default state', function () {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
expect(
|
|
10
|
-
expect(emptyState.props()).toMatchObject({
|
|
11
|
-
text: 'History in the making',
|
|
12
|
-
secondaryText: 'When you create an event or perform an activity, it will show up here.'
|
|
13
|
-
});
|
|
6
|
+
render(React.createElement(HistoryPanelEmptyState, null));
|
|
7
|
+
expect(screen.getByText('History in the making')).toBeInTheDocument();
|
|
8
|
+
expect(screen.getByText('When you create an event or perform an activity, it will show up here.')).toBeInTheDocument();
|
|
14
9
|
});
|
|
15
10
|
});
|
|
@@ -17,7 +17,7 @@ export var HistoryRow = function (_a) {
|
|
|
17
17
|
_b)), onClick: onClick },
|
|
18
18
|
React.createElement("div", { className: styles.rowHeader },
|
|
19
19
|
React.createElement("div", { className: styles.badge }),
|
|
20
|
-
React.createElement(Typography, { className: classnames(styles.title, { bold: isCurrent }) }, isCurrent ? i18n.text('Current view') : getActivityLabel(type)),
|
|
20
|
+
React.createElement(Typography, { "data-reltio-id": "history-row-header", className: classnames(styles.title, { bold: isCurrent }) }, isCurrent ? i18n.text('Current view') : getActivityLabel(type)),
|
|
21
21
|
!isCurrent && React.createElement(Typography, { className: styles.date }, i18n.date(timestamp, 'L LT'))),
|
|
22
22
|
matchGroups && (React.createElement(Typography, { className: styles.title },
|
|
23
23
|
i18n.text('Match rule:'),
|