@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.
Files changed (27) hide show
  1. package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.d.ts +2 -1
  2. package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.js +4 -3
  3. package/cjs/ModeSwitcherSelect/ModeSwitcherSelect.test.js +232 -89
  4. package/cjs/ModeSwitcherSelect/styles.d.ts +1 -1
  5. package/cjs/ModeSwitcherSelect/styles.js +18 -0
  6. package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
  7. package/cjs/contexts/MdmModuleContext/hooks.d.ts +2 -1
  8. package/cjs/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.js +1 -1
  9. package/cjs/features/history/HistoryRow/HistoryRow.js +3 -1
  10. package/cjs/features/history/HistoryTree/HistoryTree.js +2 -7
  11. package/cjs/features/history/HistoryTree/HistoryTree.specs.js +141 -223
  12. package/cjs/features/workflow/WorkflowComments/WorkflowComments.js +1 -1
  13. package/cjs/features/workflow/WorkflowComments/WorkflowCommments.spec.js +6 -0
  14. package/esm/ModeSwitcherSelect/ModeSwitcherSelect.d.ts +2 -1
  15. package/esm/ModeSwitcherSelect/ModeSwitcherSelect.js +4 -3
  16. package/esm/ModeSwitcherSelect/ModeSwitcherSelect.test.js +232 -89
  17. package/esm/ModeSwitcherSelect/styles.d.ts +1 -1
  18. package/esm/ModeSwitcherSelect/styles.js +18 -0
  19. package/esm/contexts/MdmModuleContext/context.d.ts +2 -0
  20. package/esm/contexts/MdmModuleContext/hooks.d.ts +2 -1
  21. package/esm/features/history/HistoryGraph/components/HistoryCircle/HistoryCircle.js +1 -1
  22. package/esm/features/history/HistoryRow/HistoryRow.js +3 -1
  23. package/esm/features/history/HistoryTree/HistoryTree.js +2 -7
  24. package/esm/features/history/HistoryTree/HistoryTree.specs.js +141 -223
  25. package/esm/features/workflow/WorkflowComments/WorkflowComments.js +1 -1
  26. package/esm/features/workflow/WorkflowComments/WorkflowCommments.spec.js +6 -0
  27. 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 Button from '@mui/material/Button';
54
- import { LinearLoadIndicator } from '../../../LinearLoadIndicator';
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 defaultMdmValues = {
95
- metadata: metadata,
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 ? defaultProps : _c, _d = _b.mdmValues, mdmValues = _d === void 0 ? defaultMdmValues : _d;
114
- return mount(React.createElement(MdmModuleProvider, { values: mdmValues, actions: mdmActions },
115
- React.createElement(HistoryTree, __assign({}, props))));
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
- var wrapper = setUp();
127
- expect(wrapper.find(LinearLoadIndicator).length).toBe(0);
128
- var graph = wrapper.find('.graph');
129
- expect(graph.length).toBe(1);
130
- expect(graph.hasClass('shadow')).toBe(false);
131
- expect(graph.find(HistoryGraph).length).toBe(1);
132
- expect(graph.find(HistoryGraph).prop('graphData')).toEqual({
133
- historyLanes: historyData.historyLanes,
134
- rows: historyData.rows.map(function (row) { return (__assign(__assign({}, row), { height: 100 })); })
135
- });
136
- expect(graph.find(ReactResizeDetector).length).toBe(1);
137
- var history = wrapper.find('.history');
138
- expect(history.length).toBe(1);
139
- var historyRows = history.find(HistoryRow);
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
- var props = __assign(__assign({}, defaultProps), { isLoading: true });
164
- var wrapper = setUp({ props: props });
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
- act(function () {
178
- var onResize = reactResizeDetector.prop('onResize');
179
- onResize();
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 render correct selected row', function () {
197
- var props = __assign(__assign({}, defaultProps), { historyEvent: historyEvent });
198
- var wrapper = setUp({ props: props });
199
- var historyRows = wrapper.find(HistoryRow);
200
- expect(historyRows.at(0).prop('isSelected')).toBeFalsy();
201
- expect(historyRows.at(1).prop('isSelected')).toBeTruthy();
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 dipatch setHistoryEvent when invoke HistoryRow prop onClick', function () {
204
- var setHistoryEvent = mdmActions.setHistoryEvent;
205
- var wrapper = setUp();
206
- act(function () {
207
- wrapper.find(HistoryRow).at(1).prop('onClick')();
208
- });
209
- var event = { aStamp: 1633089195406, overrideUri: null };
210
- expect(setHistoryEvent).toBeCalledWith(event);
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 dipatch clearHistoryEvent when invoke HistoryRow prop onClick on selected event', function () {
213
- var clearHistoryEvent = mdmActions.clearHistoryEvent;
214
- var props = __assign(__assign({}, defaultProps), { historyEvent: historyEvent });
215
- var wrapper = setUp({ props: props });
216
- act(function () {
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 dipatch clearHistoryEvent when invoke HistoryRow prop onClick on the latest event', function () {
222
- var clearHistoryEvent = mdmActions.clearHistoryEvent;
223
- var props = __assign(__assign({}, defaultProps), { historyEvent: historyEvent });
224
- var wrapper = setUp({ props: props });
225
- act(function () {
226
- wrapper.find(HistoryRow).at(0).prop('onClick')();
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
- expect(clearHistoryEvent).toHaveBeenCalled();
229
- });
230
- it('should not dipatch clearHistoryEvent when invoke HistoryRow prop onClick on the latest event if props.historyEvent is undefined', function () {
231
- var clearHistoryEvent = mdmActions.clearHistoryEvent;
232
- var wrapper = setUp();
233
- act(function () {
234
- wrapper.find(HistoryRow).at(0).prop('onClick')();
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
- expect(clearHistoryEvent).not.toBeCalled();
237
- });
238
- it('should dipatch modeUpdated and setHistoryEvent when invoke HistoryRow prop onClick in Editing mode and apply confirmation', function () {
239
- var confirm = jest.spyOn(window, 'confirm').mockReturnValue(true);
240
- var modeUpdated = mdmActions.modeUpdated, setHistoryEvent = mdmActions.setHistoryEvent;
241
- var mdmValues = __assign(__assign({}, defaultMdmValues), { mode: Mode.Editing });
242
- var wrapper = setUp({ mdmValues: mdmValues });
243
- act(function () {
244
- wrapper.find(HistoryRow).at(1).prop('onClick')();
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
- var event = {
247
- aStamp: 1633089195406,
248
- overrideUri: null
249
- };
250
- expect(confirm).toHaveBeenCalledWith(i18n.text('Are you sure you want to go in history mode? All your changes will be lost.'));
251
- expect(modeUpdated).toHaveBeenCalledWith(Mode.Viewing);
252
- expect(setHistoryEvent).toHaveBeenCalledWith(event);
253
- });
254
- it('should dipatch nothing when invoke HistoryRow prop onClick in Editing mode and cancel confirmation', function () {
255
- var confirm = jest.spyOn(window, 'confirm').mockReturnValue(false);
256
- var modeUpdated = mdmActions.modeUpdated, setHistoryEvent = mdmActions.setHistoryEvent, clearHistoryEvent = mdmActions.clearHistoryEvent;
257
- var mdmValues = __assign(__assign({}, defaultMdmValues), { mode: Mode.Editing });
258
- var wrapper = setUp({ mdmValues: mdmValues });
259
- act(function () {
260
- wrapper.find(HistoryRow).at(1).prop('onClick')();
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
- expect(confirm).toHaveBeenCalledWith(i18n.text('Are you sure you want to go in history mode? All your changes will be lost.'));
263
- expect(clearHistoryEvent).not.toHaveBeenCalled();
264
- expect(setHistoryEvent).not.toHaveBeenCalled();
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
- wrapper = setUp();
281
- graphData = {
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
- time: 1636456567409,
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
- wrapper.update();
312
- expect(wrapper.find(HistoryGraph).prop('graphData')).toEqual(__assign(__assign({}, graphData), { rows: [__assign(__assign({}, graphData.rows[0]), { label: 'AMA, Reltio, DEA' }), graphData.rows[1]] }));
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('handleHistoryCircleMouseOver handler should work correctly when crosswalks do not exist', function () { return __awaiter(void 0, void 0, void 0, function () {
333
- var wrapper, graphData;
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
- wrapper = setUp();
339
- graphData = {
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
- time: 1636456567409,
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
- wrapper.update();
369
- expect(wrapper.find(HistoryGraph).prop('graphData')).toEqual(__assign(__assign({}, graphData), { rows: [__assign(__assign({}, graphData.rows[0]), { label: 'No data' }), graphData.rows[1]] }));
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.1896",
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.1828",
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",