@reltio/components 1.4.1896 → 1.4.1898
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/ModeSwitcherSelect/ModeSwitcherSelect.d.ts +2 -1
- package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.js +4 -3
- package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.test.js +232 -89
- package/cjs/ModeSwitcherSelect/styles.d.ts +1 -1
- package/cjs/ModeSwitcherSelect/styles.js +18 -0
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/cjs/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.js +1 -1
- package/cjs/features/history/HistoryRow/HistoryRow.js +3 -1
- package/cjs/features/history/HistoryTree/HistoryTree.js +2 -7
- package/cjs/features/history/HistoryTree/HistoryTree.specs.js +141 -223
- package/cjs/features/workflow/WorkflowComments/WorkflowComments.js +1 -1
- package/cjs/features/workflow/WorkflowComments/WorkflowCommments.spec.js +6 -0
- package/esm/ModeSwitcherSelect/ModeSwitcherSelect.d.ts +2 -1
- package/esm/ModeSwitcherSelect/ModeSwitcherSelect.js +4 -3
- package/esm/ModeSwitcherSelect/ModeSwitcherSelect.test.js +232 -89
- package/esm/ModeSwitcherSelect/styles.d.ts +1 -1
- package/esm/ModeSwitcherSelect/styles.js +18 -0
- package/esm/contexts/MdmModuleContext/context.d.ts +2 -0
- package/esm/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/esm/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.js +1 -1
- package/esm/features/history/HistoryRow/HistoryRow.js +3 -1
- package/esm/features/history/HistoryTree/HistoryTree.js +2 -7
- package/esm/features/history/HistoryTree/HistoryTree.specs.js +141 -223
- package/esm/features/workflow/WorkflowComments/WorkflowComments.js +1 -1
- package/esm/features/workflow/WorkflowComments/WorkflowCommments.spec.js +6 -0
- package/package.json +2 -2
|
@@ -46,14 +46,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import React from 'react';
|
|
49
|
-
import { mount } from 'enzyme';
|
|
50
|
-
import { act } from 'react-dom/test-utils';
|
|
51
|
-
import ReactResizeDetector from 'react-resize-detector';
|
|
52
49
|
import i18n from 'ui-i18n';
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import { HistoryGraph } from '../HistoryGraph';
|
|
56
|
-
import { HistoryRow } from '../HistoryRow';
|
|
50
|
+
import { render, screen, within, fireEvent } from '@testing-library/react';
|
|
51
|
+
import userEvent from '@testing-library/user-event';
|
|
57
52
|
import { Mode, getEntity } from '@reltio/mdm-sdk';
|
|
58
53
|
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
59
54
|
import { HistoryTree } from './HistoryTree';
|
|
@@ -67,6 +62,7 @@ var metadata = {
|
|
|
67
62
|
{ uri: 'configuration/sources/DEA', label: 'DEA' }
|
|
68
63
|
]
|
|
69
64
|
};
|
|
65
|
+
var historyEvent = { aStamp: 1633089195406, overrideUri: 'entities/123' };
|
|
70
66
|
var historyData = {
|
|
71
67
|
historyLanes: {
|
|
72
68
|
'entities/123': {
|
|
@@ -91,15 +87,8 @@ var historyData = {
|
|
|
91
87
|
}
|
|
92
88
|
]
|
|
93
89
|
};
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
mode: Mode.Viewing
|
|
97
|
-
};
|
|
98
|
-
var mdmActions = {
|
|
99
|
-
setHistoryEvent: jest.fn(),
|
|
100
|
-
clearHistoryEvent: jest.fn(),
|
|
101
|
-
modeUpdated: jest.fn()
|
|
102
|
-
};
|
|
90
|
+
var mdmActions = { setHistoryEvent: jest.fn(), clearHistoryEvent: jest.fn(), modeUpdateRequested: jest.fn() };
|
|
91
|
+
var defaultMdmValues = { metadata: metadata, mode: Mode.Viewing };
|
|
103
92
|
var defaultProps = {
|
|
104
93
|
historyData: historyData,
|
|
105
94
|
isLoading: false,
|
|
@@ -110,12 +99,15 @@ var defaultProps = {
|
|
|
110
99
|
findPreviousChange: function (index) { return historyData.rows[index + 1]; }
|
|
111
100
|
};
|
|
112
101
|
var setUp = function (_a) {
|
|
113
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ?
|
|
114
|
-
|
|
115
|
-
|
|
102
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.props, props = _c === void 0 ? {} : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
|
|
103
|
+
var user = userEvent.setup();
|
|
104
|
+
var Providers = function (_a) {
|
|
105
|
+
var children = _a.children;
|
|
106
|
+
return (React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions }, children));
|
|
107
|
+
};
|
|
108
|
+
return __assign({ user: user }, render(React.createElement(HistoryTree, __assign({}, defaultProps, props)), { wrapper: Providers }));
|
|
116
109
|
};
|
|
117
110
|
describe('HistoryTree tests', function () {
|
|
118
|
-
var historyEvent = { aStamp: 1633089195406, overrideUri: 'entities/123' };
|
|
119
111
|
beforeAll(function () {
|
|
120
112
|
jest.spyOn(Element.prototype, 'clientHeight', 'get').mockReturnValue(100);
|
|
121
113
|
});
|
|
@@ -123,149 +115,135 @@ describe('HistoryTree tests', function () {
|
|
|
123
115
|
jest.clearAllMocks();
|
|
124
116
|
});
|
|
125
117
|
it('should render correct default state', function () {
|
|
126
|
-
|
|
127
|
-
expect(
|
|
128
|
-
var
|
|
129
|
-
expect(
|
|
130
|
-
|
|
131
|
-
expect(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
expect(
|
|
139
|
-
|
|
140
|
-
expect(historyRows.length).toBe(2);
|
|
141
|
-
historyRows.forEach(function (row, i) {
|
|
142
|
-
expect(row.prop('change')).toBe(historyData.rows[i]);
|
|
143
|
-
expect(row.prop('isCurrent')).toBe(i === 0);
|
|
144
|
-
expect(row.prop('isSelected')).toBe(i === 0);
|
|
145
|
-
});
|
|
146
|
-
var buttonContainer = wrapper.find('.buttonContainer');
|
|
147
|
-
expect(buttonContainer.length).toBe(0);
|
|
148
|
-
});
|
|
149
|
-
it('should show "load more" button and call onLoadMore prop on click if canLoadMore === true', function () {
|
|
150
|
-
var onLoadMore = defaultProps.onLoadMore;
|
|
151
|
-
var props = __assign(__assign({}, defaultProps), { canLoadMore: true });
|
|
152
|
-
var wrapper = setUp({ props: props });
|
|
153
|
-
expect(onLoadMore).not.toBeCalled();
|
|
154
|
-
var buttonContainer = wrapper.find('.buttonContainer');
|
|
155
|
-
expect(buttonContainer.length).toBe(1);
|
|
156
|
-
var button = buttonContainer.find(Button).find('button');
|
|
157
|
-
expect(button.length).toBe(1);
|
|
158
|
-
expect(button.text()).toBe('Show more');
|
|
159
|
-
button.simulate('click');
|
|
160
|
-
expect(onLoadMore).toBeCalled();
|
|
118
|
+
setUp();
|
|
119
|
+
expect(screen.getByTestId('reltio-history-graph')).toBeInTheDocument();
|
|
120
|
+
var rows = screen.getAllByTestId('history-row');
|
|
121
|
+
expect(rows).toHaveLength(2);
|
|
122
|
+
var current = rows[0], unmerged = rows[1];
|
|
123
|
+
expect(current).toHaveClass('selected');
|
|
124
|
+
within(current).getByText('Current view');
|
|
125
|
+
within(current).getByText('user1');
|
|
126
|
+
within(unmerged).getByText(i18n.date(historyData.rows[1].timestamp, 'L LT'));
|
|
127
|
+
within(unmerged).getByText('Profile un-merged');
|
|
128
|
+
within(unmerged).getByText('user2');
|
|
129
|
+
within(unmerged).getByText(i18n.date(historyData.rows[1].timestamp, 'L LT'));
|
|
130
|
+
expect(screen.queryByTestId('reltio-linear-load-indicator')).not.toBeInTheDocument();
|
|
131
|
+
expect(screen.queryByText('Show more')).not.toBeInTheDocument();
|
|
161
132
|
});
|
|
133
|
+
it('should show "load more" button and call onLoadMore prop on click if canLoadMore === true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
|
+
var user;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0:
|
|
138
|
+
user = setUp({ props: { canLoadMore: true } }).user;
|
|
139
|
+
return [4 /*yield*/, user.click(screen.getByText('Show more'))];
|
|
140
|
+
case 1:
|
|
141
|
+
_a.sent();
|
|
142
|
+
expect(defaultProps.onLoadMore).toBeCalled();
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}); });
|
|
162
147
|
it('should show loading indicator if isLoading === true', function () {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
expect(wrapper.find(LinearLoadIndicator).length).toBe(1);
|
|
148
|
+
setUp({ props: { isLoading: true } });
|
|
149
|
+
expect(screen.getByTestId('reltio-linear-load-indicator')).toBeInTheDocument();
|
|
166
150
|
});
|
|
167
|
-
it('should show shadow if content scrollable right', function () {
|
|
168
|
-
var wrapper = setUp();
|
|
169
|
-
var graph = wrapper.find('.graph');
|
|
170
|
-
var reactResizeDetector = wrapper.find(ReactResizeDetector);
|
|
171
|
-
expect(graph.length).toBe(1);
|
|
172
|
-
expect(graph.hasClass('shadow')).toBe(false);
|
|
173
|
-
expect(reactResizeDetector.length).toBe(1);
|
|
151
|
+
it('should show shadow if content is scrollable right', function () {
|
|
174
152
|
jest.spyOn(Element.prototype, 'clientWidth', 'get').mockReturnValue(100);
|
|
175
153
|
jest.spyOn(Element.prototype, 'scrollWidth', 'get').mockReturnValue(150);
|
|
176
154
|
jest.spyOn(Element.prototype, 'scrollLeft', 'get').mockReturnValueOnce(0);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
wrapper.update();
|
|
182
|
-
expect(wrapper.find('.graph').hasClass('shadow')).toBe(true);
|
|
183
|
-
jest.spyOn(Element.prototype, 'scrollLeft', 'get').mockReturnValueOnce(50);
|
|
184
|
-
act(function () {
|
|
185
|
-
wrapper.find('.graph').simulate('scroll');
|
|
186
|
-
});
|
|
187
|
-
wrapper.update();
|
|
188
|
-
expect(wrapper.find('.graph').hasClass('shadow')).toBe(false);
|
|
189
|
-
});
|
|
190
|
-
it('should render the latest event as selected if props.historyEvent is undefined', function () {
|
|
191
|
-
var wrapper = setUp();
|
|
192
|
-
var historyRows = wrapper.find(HistoryRow);
|
|
193
|
-
expect(historyRows.at(0).prop('isSelected')).toBeTruthy();
|
|
194
|
-
expect(historyRows.at(1).prop('isSelected')).toBeFalsy();
|
|
155
|
+
setUp();
|
|
156
|
+
var graph = screen.getByTestId('reltio-history-graph');
|
|
157
|
+
fireEvent.scroll(graph.parentElement);
|
|
158
|
+
expect(graph.parentElement).toHaveClass('shadow');
|
|
195
159
|
});
|
|
196
|
-
it('should
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
160
|
+
it('should not show shadow if content is not scrollable right', function () {
|
|
161
|
+
jest.spyOn(Element.prototype, 'clientWidth', 'get').mockReturnValue(100);
|
|
162
|
+
jest.spyOn(Element.prototype, 'scrollWidth', 'get').mockReturnValue(100);
|
|
163
|
+
jest.spyOn(Element.prototype, 'scrollLeft', 'get').mockReturnValueOnce(0);
|
|
164
|
+
setUp();
|
|
165
|
+
var graph = screen.getByTestId('reltio-history-graph');
|
|
166
|
+
fireEvent.scroll(graph.parentElement);
|
|
167
|
+
expect(graph.parentElement).not.toHaveClass('shadow');
|
|
202
168
|
});
|
|
203
|
-
it('should
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
expect(
|
|
169
|
+
it('should not show shadow if content is scrollable right but you scrolled right already', function () {
|
|
170
|
+
jest.spyOn(Element.prototype, 'clientWidth', 'get').mockReturnValue(100);
|
|
171
|
+
jest.spyOn(Element.prototype, 'scrollWidth', 'get').mockReturnValue(150);
|
|
172
|
+
jest.spyOn(Element.prototype, 'scrollLeft', 'get').mockReturnValueOnce(50);
|
|
173
|
+
setUp();
|
|
174
|
+
var graph = screen.getByTestId('reltio-history-graph');
|
|
175
|
+
fireEvent.scroll(graph.parentElement);
|
|
176
|
+
expect(graph.parentElement).not.toHaveClass('shadow');
|
|
211
177
|
});
|
|
212
|
-
it('should
|
|
213
|
-
|
|
214
|
-
var
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
wrapper.find(HistoryRow).at(1).prop('onClick')();
|
|
218
|
-
});
|
|
219
|
-
expect(clearHistoryEvent).toHaveBeenCalled();
|
|
178
|
+
it('should render correct selected row', function () {
|
|
179
|
+
setUp({ props: { historyEvent: historyEvent } });
|
|
180
|
+
var rows = screen.getAllByTestId('history-row');
|
|
181
|
+
expect(rows[0]).not.toHaveClass('selected');
|
|
182
|
+
expect(rows[1]).toHaveClass('selected');
|
|
220
183
|
});
|
|
221
|
-
it('should
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
184
|
+
it('should dispatch setHistoryEvent when invoke HistoryRow prop onClick', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
185
|
+
var user;
|
|
186
|
+
return __generator(this, function (_a) {
|
|
187
|
+
switch (_a.label) {
|
|
188
|
+
case 0:
|
|
189
|
+
user = setUp().user;
|
|
190
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('history-row')[1])];
|
|
191
|
+
case 1:
|
|
192
|
+
_a.sent();
|
|
193
|
+
expect(mdmActions.clearHistoryEvent).not.toHaveBeenCalled();
|
|
194
|
+
expect(mdmActions.setHistoryEvent).toHaveBeenCalledWith({ aStamp: 1633089195406, overrideUri: null });
|
|
195
|
+
return [2 /*return*/];
|
|
196
|
+
}
|
|
227
197
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
198
|
+
}); });
|
|
199
|
+
it('should dispatch clearHistoryEvent when click on selected view', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
200
|
+
var user;
|
|
201
|
+
return __generator(this, function (_a) {
|
|
202
|
+
switch (_a.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
user = setUp({ props: { historyEvent: historyEvent } }).user;
|
|
205
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('history-row')[1])];
|
|
206
|
+
case 1:
|
|
207
|
+
_a.sent();
|
|
208
|
+
expect(mdmActions.clearHistoryEvent).toHaveBeenCalled();
|
|
209
|
+
expect(mdmActions.setHistoryEvent).not.toHaveBeenCalled();
|
|
210
|
+
return [2 /*return*/];
|
|
211
|
+
}
|
|
235
212
|
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
213
|
+
}); });
|
|
214
|
+
it('should dispatch clearHistoryEvent when click on current view', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
215
|
+
var user;
|
|
216
|
+
return __generator(this, function (_a) {
|
|
217
|
+
switch (_a.label) {
|
|
218
|
+
case 0:
|
|
219
|
+
user = setUp({ props: { historyEvent: historyEvent } }).user;
|
|
220
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('history-row')[0])];
|
|
221
|
+
case 1:
|
|
222
|
+
_a.sent();
|
|
223
|
+
expect(mdmActions.clearHistoryEvent).toHaveBeenCalled();
|
|
224
|
+
expect(mdmActions.setHistoryEvent).not.toHaveBeenCalled();
|
|
225
|
+
return [2 /*return*/];
|
|
226
|
+
}
|
|
245
227
|
});
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
228
|
+
}); });
|
|
229
|
+
it('should dispatch modeUpdateRequested and setHistoryEvent when click in Editing mode', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
230
|
+
var user;
|
|
231
|
+
return __generator(this, function (_a) {
|
|
232
|
+
switch (_a.label) {
|
|
233
|
+
case 0:
|
|
234
|
+
user = setUp({ mdmValues: __assign(__assign({}, defaultMdmValues), { mode: Mode.Editing }) }).user;
|
|
235
|
+
return [4 /*yield*/, user.click(screen.getAllByTestId('history-row')[1])];
|
|
236
|
+
case 1:
|
|
237
|
+
_a.sent();
|
|
238
|
+
expect(mdmActions.clearHistoryEvent).not.toHaveBeenCalled();
|
|
239
|
+
expect(mdmActions.setHistoryEvent).toHaveBeenCalledWith({ aStamp: 1633089195406, overrideUri: null });
|
|
240
|
+
expect(mdmActions.modeUpdateRequested).toHaveBeenCalledWith(Mode.Viewing);
|
|
241
|
+
return [2 /*return*/];
|
|
242
|
+
}
|
|
261
243
|
});
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
expect(modeUpdated).not.toHaveBeenCalled();
|
|
266
|
-
});
|
|
267
|
-
it('handleHistoryCircleMouseOver handler should work correctly when crosswalks exist', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
-
var crosswalks, wrapper, graphData;
|
|
244
|
+
}); });
|
|
245
|
+
it('should request circle label correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
246
|
+
var crosswalks, user;
|
|
269
247
|
return __generator(this, function (_a) {
|
|
270
248
|
switch (_a.label) {
|
|
271
249
|
case 0:
|
|
@@ -277,96 +255,36 @@ describe('HistoryTree tests', function () {
|
|
|
277
255
|
{ type: 'configuration/sources/MDS' }
|
|
278
256
|
];
|
|
279
257
|
getEntity.mockImplementation(function () { return Promise.resolve({ crosswalks: crosswalks }); });
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
historyLanes: historyData.historyLanes,
|
|
283
|
-
rows: historyData.rows.map(function (row) { return (__assign(__assign({}, row), { height: 100 })); })
|
|
284
|
-
};
|
|
285
|
-
expect(wrapper.find(HistoryGraph).prop('graphData')).toEqual(graphData);
|
|
286
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
287
|
-
var onHistoryCircleMouseOver;
|
|
288
|
-
return __generator(this, function (_a) {
|
|
289
|
-
onHistoryCircleMouseOver = wrapper.find(HistoryGraph).prop('onHistoryCircleMouseOver');
|
|
290
|
-
if (onHistoryCircleMouseOver) {
|
|
291
|
-
onHistoryCircleMouseOver('entities/123', 1636456567409, 0);
|
|
292
|
-
}
|
|
293
|
-
return [2 /*return*/];
|
|
294
|
-
});
|
|
295
|
-
}); })];
|
|
258
|
+
user = setUp().user;
|
|
259
|
+
return [4 /*yield*/, user.hover(screen.getAllByTestId('history-circle')[0])];
|
|
296
260
|
case 1:
|
|
297
261
|
_a.sent();
|
|
298
|
-
expect(getEntity).toHaveBeenCalledWith('entities/123', {
|
|
299
|
-
|
|
300
|
-
select: 'crosswalks'
|
|
301
|
-
});
|
|
302
|
-
expect(getEntity.mock.calls.length).toBe(1);
|
|
303
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
304
|
-
return __generator(this, function (_a) {
|
|
305
|
-
Promise.resolve();
|
|
306
|
-
return [2 /*return*/];
|
|
307
|
-
});
|
|
308
|
-
}); })];
|
|
262
|
+
expect(getEntity).toHaveBeenCalledWith('entities/123', { time: 1636456567409, select: 'crosswalks' });
|
|
263
|
+
return [4 /*yield*/, user.hover(screen.getAllByTestId('history-circle')[0])];
|
|
309
264
|
case 2:
|
|
310
265
|
_a.sent();
|
|
311
|
-
|
|
312
|
-
expect(
|
|
313
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
314
|
-
var onHistoryCircleMouseOver;
|
|
315
|
-
return __generator(this, function (_a) {
|
|
316
|
-
onHistoryCircleMouseOver = wrapper.find(HistoryGraph).prop('onHistoryCircleMouseOver');
|
|
317
|
-
if (onHistoryCircleMouseOver) {
|
|
318
|
-
onHistoryCircleMouseOver('entities/123', 1636456567409, 0);
|
|
319
|
-
}
|
|
320
|
-
return [2 /*return*/];
|
|
321
|
-
});
|
|
322
|
-
}); })];
|
|
323
|
-
case 3:
|
|
324
|
-
_a.sent();
|
|
325
|
-
expect(getEntity.mock.calls.length).toBe(1);
|
|
326
|
-
wrapper.update();
|
|
327
|
-
expect(wrapper.find(HistoryGraph).prop('graphData')).toEqual(__assign(__assign({}, graphData), { rows: [__assign(__assign({}, graphData.rows[0]), { label: 'AMA, Reltio, DEA' }), graphData.rows[1]] }));
|
|
266
|
+
screen.getByText('AMA, Reltio, DEA');
|
|
267
|
+
expect(getEntity).toHaveBeenCalledTimes(1);
|
|
328
268
|
return [2 /*return*/];
|
|
329
269
|
}
|
|
330
270
|
});
|
|
331
271
|
}); });
|
|
332
|
-
it('
|
|
333
|
-
var
|
|
272
|
+
it('should work correctly when there is no crosswalks for circle', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
273
|
+
var user;
|
|
334
274
|
return __generator(this, function (_a) {
|
|
335
275
|
switch (_a.label) {
|
|
336
276
|
case 0:
|
|
337
277
|
getEntity.mockImplementation(function () { return Promise.resolve({}); });
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
historyLanes: historyData.historyLanes,
|
|
341
|
-
rows: historyData.rows.map(function (row) { return (__assign(__assign({}, row), { height: 100 })); })
|
|
342
|
-
};
|
|
343
|
-
expect(wrapper.find(HistoryGraph).prop('graphData')).toEqual(graphData);
|
|
344
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
345
|
-
var onHistoryCircleMouseOver;
|
|
346
|
-
return __generator(this, function (_a) {
|
|
347
|
-
onHistoryCircleMouseOver = wrapper.find(HistoryGraph).prop('onHistoryCircleMouseOver');
|
|
348
|
-
if (onHistoryCircleMouseOver) {
|
|
349
|
-
onHistoryCircleMouseOver('entities/123', 1636456567409, 0);
|
|
350
|
-
}
|
|
351
|
-
return [2 /*return*/];
|
|
352
|
-
});
|
|
353
|
-
}); })];
|
|
278
|
+
user = setUp().user;
|
|
279
|
+
return [4 /*yield*/, user.hover(screen.getAllByTestId('history-circle')[0])];
|
|
354
280
|
case 1:
|
|
355
281
|
_a.sent();
|
|
356
|
-
expect(getEntity).toHaveBeenCalledWith('entities/123', {
|
|
357
|
-
|
|
358
|
-
select: 'crosswalks'
|
|
359
|
-
});
|
|
360
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
361
|
-
return __generator(this, function (_a) {
|
|
362
|
-
Promise.resolve();
|
|
363
|
-
return [2 /*return*/];
|
|
364
|
-
});
|
|
365
|
-
}); })];
|
|
282
|
+
expect(getEntity).toHaveBeenCalledWith('entities/123', { time: 1636456567409, select: 'crosswalks' });
|
|
283
|
+
return [4 /*yield*/, user.hover(screen.getAllByTestId('history-circle')[0])];
|
|
366
284
|
case 2:
|
|
367
285
|
_a.sent();
|
|
368
|
-
|
|
369
|
-
expect(
|
|
286
|
+
screen.getByText('No data');
|
|
287
|
+
expect(getEntity).toHaveBeenCalledTimes(1);
|
|
370
288
|
return [2 /*return*/];
|
|
371
289
|
}
|
|
372
290
|
});
|
|
@@ -63,5 +63,5 @@ export var WorkflowComments = function (_a) {
|
|
|
63
63
|
React.createElement(SmallIconButton, { icon: SendIcon, disabled: comment.length === 0, onClick: sendComment, "data-reltio-id": "send-button" })), classes: { root: styles.filledInputRoot }, placeholder: i18n.text('Write a comment'), value: comment, onKeyPress: handleKeyPress, onChange: handleChange, disableUnderline: true, multiline: true })),
|
|
64
64
|
React.createElement("div", { className: styles.modeSwitcherWrapper },
|
|
65
65
|
buttonsGroup.length === 1 && (React.createElement(Button, { variant: "outlined", onClick: buttonsGroup[0].onClick, disabled: actionRequestIsInProgress }, buttonsGroup[0].label)),
|
|
66
|
-
buttonsGroup.length > 1 && (React.createElement(ModeSwitcherSelect, { buttonsGroup: buttonsGroup, value: currentAction, disabled: actionRequestIsInProgress })))));
|
|
66
|
+
buttonsGroup.length > 1 && (React.createElement(ModeSwitcherSelect, { buttonsGroup: buttonsGroup, value: currentAction, loading: actionRequestIsInProgress, disabled: actionRequestIsInProgress })))));
|
|
67
67
|
};
|
|
@@ -230,4 +230,10 @@ describe('WorkflowComments tests', function () {
|
|
|
230
230
|
it('should not crash if preferredAction is undefined and workflowActions is empty array', function () {
|
|
231
231
|
setUp({ props: __assign(__assign({}, defaultProps), { preferredAction: undefined, workflowActions: [] }) });
|
|
232
232
|
});
|
|
233
|
+
it('should disabled action button and add loading if actionRequestIsInProgress is true', function () {
|
|
234
|
+
setUp({ props: __assign(__assign({}, defaultProps), { actionRequestIsInProgress: true }) });
|
|
235
|
+
var button = screen.getByRole('button', { name: 'Delete' });
|
|
236
|
+
expect(button).toHaveClass('Mui-disabled');
|
|
237
|
+
screen.getByTestId('mode-loading-spinner');
|
|
238
|
+
});
|
|
233
239
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1898",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
10
|
"@react-sigma/core": "3.4.0",
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1830",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|