@reltio/components 1.4.2155 → 1.4.2157
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/BarChart/helpers.js +3 -0
- package/ChartLegend/styles.js +2 -1
- package/ChartTooltip/styles.js +2 -1
- package/CollaborationItem/components/CommentTarget/styles.js +2 -1
- package/ComplexAttributeLabel/styles.js +2 -1
- package/DefaultCellValueRenderer/styles.js +1 -1
- package/EditModeComplexAttribute/styles.js +2 -1
- package/EntitySelector/components/EntityOption/styles.js +1 -1
- package/HOCs/withFilter/components/FilterChip/styles.js +1 -1
- package/HOCs/withReactSelectMuiSkin/styles.js +2 -1
- package/HierarchyNodeTitle/styles.js +1 -1
- package/InlineSimpleAttribute/styles.js +2 -1
- package/PivotingTooltip/components/PivotingTooltipContent/styles.js +2 -1
- package/PivotingTooltip/styles.js +2 -1
- package/ProfileBand/styles.js +4 -1
- package/ProfileCard/components/ProfileCardContent/styles.js +2 -2
- package/ProfilesList/styles.js +6 -3
- package/ReadOnlyComplexAttribute/styles.js +2 -1
- package/ScreenProfileBand/ScreenProfileBand.test.js +1 -1
- package/SimpleAttribute/styles.js +2 -1
- package/TableWithBars/components/AttributeCellRenderer/styles.js +1 -1
- package/TypeaheadEditor/styles.js +2 -1
- package/ValueChip/styles.js +1 -1
- package/cjs/BarChart/helpers.js +3 -0
- package/cjs/ChartLegend/styles.js +2 -1
- package/cjs/ChartTooltip/styles.js +2 -1
- package/cjs/CollaborationItem/components/CommentTarget/styles.js +2 -1
- package/cjs/ComplexAttributeLabel/styles.js +2 -1
- package/cjs/DefaultCellValueRenderer/styles.js +1 -1
- package/cjs/EditModeComplexAttribute/styles.js +2 -1
- package/cjs/EntitySelector/components/EntityOption/styles.js +1 -1
- package/cjs/HOCs/withFilter/components/FilterChip/styles.js +1 -1
- package/cjs/HOCs/withReactSelectMuiSkin/styles.js +2 -1
- package/cjs/HierarchyNodeTitle/styles.js +1 -1
- package/cjs/InlineSimpleAttribute/styles.js +2 -1
- package/cjs/PivotingTooltip/components/PivotingTooltipContent/styles.js +2 -1
- package/cjs/PivotingTooltip/styles.js +2 -1
- package/cjs/ProfileBand/styles.js +4 -1
- package/cjs/ProfileCard/components/ProfileCardContent/styles.js +2 -2
- package/cjs/ProfilesList/styles.js +6 -3
- package/cjs/ReadOnlyComplexAttribute/styles.js +2 -1
- package/cjs/ScreenProfileBand/ScreenProfileBand.test.js +1 -1
- package/cjs/SimpleAttribute/styles.js +2 -1
- package/cjs/TableWithBars/components/AttributeCellRenderer/styles.js +1 -1
- package/cjs/TypeaheadEditor/styles.js +2 -1
- package/cjs/ValueChip/styles.js +1 -1
- package/cjs/constants/theme.d.ts +5 -0
- package/cjs/constants/theme.js +5 -0
- package/cjs/features/activity-log/ActivitiesFactory/components/SimpleActivity/styles.js +2 -1
- package/cjs/features/activity-log/EntityObject/styles.js +1 -0
- package/cjs/features/activity-log/Field/styles.js +2 -1
- package/cjs/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/styles.js +2 -1
- package/cjs/features/activity-log/RelationObject/styles.js +2 -1
- package/cjs/features/workflow/AttributesChanges/components/DiffRenderer/styles.js +2 -1
- package/cjs/features/workflow/AttributesChanges/styles.js +2 -1
- package/cjs/hooks/useCollaboration/useCollaboration.d.ts +2 -1
- package/cjs/hooks/useCollaboration/useCollaboration.js +24 -18
- package/cjs/hooks/useCollaboration/useCollaboration.test.js +112 -171
- package/constants/theme.d.ts +5 -0
- package/constants/theme.js +5 -0
- package/features/activity-log/ActivitiesFactory/components/SimpleActivity/styles.js +2 -1
- package/features/activity-log/EntityObject/styles.js +1 -0
- package/features/activity-log/Field/styles.js +2 -1
- package/features/activity-log/PotentialMatchRecord/components/PotentialMatchField/styles.js +2 -1
- package/features/activity-log/RelationObject/styles.js +2 -1
- package/features/workflow/AttributesChanges/components/DiffRenderer/styles.js +2 -1
- package/features/workflow/AttributesChanges/styles.js +2 -1
- package/hooks/useCollaboration/useCollaboration.d.ts +2 -1
- package/hooks/useCollaboration/useCollaboration.js +24 -18
- package/hooks/useCollaboration/useCollaboration.test.js +112 -171
- package/package.json +2 -2
|
@@ -92,31 +92,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
92
92
|
expect(getCommentsCount).not.toHaveBeenCalled();
|
|
93
93
|
expect(getTotalCommentsCount).not.toHaveBeenCalled();
|
|
94
94
|
});
|
|
95
|
-
it('should not call getCommentsCount if totalCommentsCount is 0', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
-
var result;
|
|
97
|
-
return __generator(this, function (_a) {
|
|
98
|
-
switch (_a.label) {
|
|
99
|
-
case 0:
|
|
100
|
-
getTotalCommentsCount.mockResolvedValue({ total: 0 });
|
|
101
|
-
result = setUp().result;
|
|
102
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
switch (_a.label) {
|
|
105
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
106
|
-
case 1:
|
|
107
|
-
_a.sent();
|
|
108
|
-
return [2 /*return*/];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}); })];
|
|
112
|
-
case 1:
|
|
113
|
-
_a.sent();
|
|
114
|
-
expect(getCommentsCount).not.toHaveBeenCalled();
|
|
115
|
-
expect(result.current.commentsMap).toEqual({});
|
|
116
|
-
return [2 /*return*/];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}); });
|
|
120
95
|
it('should call getCommentsCount if collaboration is enabled and uris is undefined and update commentsMap value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
121
96
|
var result;
|
|
122
97
|
return __generator(this, function (_a) {
|
|
@@ -147,7 +122,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
147
122
|
}
|
|
148
123
|
});
|
|
149
124
|
}); });
|
|
150
|
-
it('should call getCommentsCount if collaboration is enabled and
|
|
125
|
+
it('should call getCommentsCount if collaboration is enabled and update commentsMap value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
126
|
var comments, result;
|
|
152
127
|
return __generator(this, function (_a) {
|
|
153
128
|
switch (_a.label) {
|
|
@@ -157,8 +132,12 @@ describe('useCollaboration behaviour', function () {
|
|
|
157
132
|
{ commentId: 'id2', status: 'open', replies: 2 }
|
|
158
133
|
];
|
|
159
134
|
getCommentsCount.mockResolvedValueOnce([{ objectId: 'uri1', comments: comments }]);
|
|
160
|
-
getTotalCommentsCount.mockResolvedValueOnce({ total: 2 });
|
|
161
135
|
result = setUp({ props: { objectIds: ['uri1'] } }).result;
|
|
136
|
+
expect(getCommentsCount).toHaveBeenCalledWith({
|
|
137
|
+
uris: ['uri1'],
|
|
138
|
+
tenant: 'alenat',
|
|
139
|
+
collaborationPath: defaultMdmValues.collaborationPath
|
|
140
|
+
});
|
|
162
141
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
163
142
|
return __generator(this, function (_a) {
|
|
164
143
|
switch (_a.label) {
|
|
@@ -171,24 +150,19 @@ describe('useCollaboration behaviour', function () {
|
|
|
171
150
|
}); })];
|
|
172
151
|
case 1:
|
|
173
152
|
_a.sent();
|
|
174
|
-
expect(getCommentsCount).toHaveBeenCalledWith({
|
|
175
|
-
uris: ['uri1'],
|
|
176
|
-
tenant: 'alenat',
|
|
177
|
-
collaborationPath: defaultMdmValues.collaborationPath
|
|
178
|
-
});
|
|
179
153
|
expect(result.current.commentsMap).toEqual({ uri1: comments });
|
|
180
154
|
return [2 /*return*/];
|
|
181
155
|
}
|
|
182
156
|
});
|
|
183
157
|
}); });
|
|
184
|
-
it('should set commentsMap value as null in case of unsuccessful
|
|
158
|
+
it('should set commentsMap value as null in case of unsuccessful request', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
185
159
|
var result;
|
|
186
160
|
return __generator(this, function (_a) {
|
|
187
161
|
switch (_a.label) {
|
|
188
162
|
case 0:
|
|
189
|
-
|
|
190
|
-
getCommentsCount.mockRejectedValueOnce(new Error('Fail'));
|
|
163
|
+
getCommentsCount.mockRejectedValueOnce(null);
|
|
191
164
|
result = setUp().result;
|
|
165
|
+
expect(getCommentsCount).toHaveBeenCalled();
|
|
192
166
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
193
167
|
return __generator(this, function (_a) {
|
|
194
168
|
switch (_a.label) {
|
|
@@ -201,7 +175,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
201
175
|
}); })];
|
|
202
176
|
case 1:
|
|
203
177
|
_a.sent();
|
|
204
|
-
expect(getCommentsCount).toHaveBeenCalled();
|
|
205
178
|
expect(result.current.commentsMap).toBe(null);
|
|
206
179
|
return [2 /*return*/];
|
|
207
180
|
}
|
|
@@ -223,20 +196,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
223
196
|
return Promise.resolve([{ objectId: 'uri2', comments: secondComments }]);
|
|
224
197
|
}
|
|
225
198
|
});
|
|
226
|
-
getTotalCommentsCount.mockResolvedValueOnce({ total: 3 });
|
|
227
199
|
result = setUp({ props: { objectIds: ['uri1'] } }).result;
|
|
228
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
229
|
-
return __generator(this, function (_a) {
|
|
230
|
-
switch (_a.label) {
|
|
231
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
232
|
-
case 1:
|
|
233
|
-
_a.sent();
|
|
234
|
-
return [2 /*return*/];
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}); })];
|
|
238
|
-
case 1:
|
|
239
|
-
_a.sent();
|
|
240
200
|
expect(getCommentsCount).toHaveBeenCalledWith({
|
|
241
201
|
uris: ['uri1'],
|
|
242
202
|
tenant: 'alenat',
|
|
@@ -248,7 +208,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
248
208
|
return [2 /*return*/];
|
|
249
209
|
});
|
|
250
210
|
}); })];
|
|
251
|
-
case
|
|
211
|
+
case 1:
|
|
252
212
|
_a.sent();
|
|
253
213
|
expect(getCommentsCount).toHaveBeenCalledWith({
|
|
254
214
|
uris: ['uri2'],
|
|
@@ -276,20 +236,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
276
236
|
return Promise.resolve([{ objectId: 'uri2', comments: secondComments }]);
|
|
277
237
|
}
|
|
278
238
|
});
|
|
279
|
-
getTotalCommentsCount.mockResolvedValue({ total: 3 });
|
|
280
239
|
_a = setUp({ props: { objectIds: ['uri1'] } }), result = _a.result, rerender = _a.rerender;
|
|
281
|
-
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
282
|
-
return __generator(this, function (_a) {
|
|
283
|
-
switch (_a.label) {
|
|
284
|
-
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
285
|
-
case 1:
|
|
286
|
-
_a.sent();
|
|
287
|
-
return [2 /*return*/];
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
}); })];
|
|
291
|
-
case 1:
|
|
292
|
-
_b.sent();
|
|
293
240
|
expect(getCommentsCount).toHaveBeenCalledWith({
|
|
294
241
|
uris: ['uri1'],
|
|
295
242
|
tenant: 'alenat',
|
|
@@ -307,7 +254,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
307
254
|
}
|
|
308
255
|
});
|
|
309
256
|
}); })];
|
|
310
|
-
case
|
|
257
|
+
case 1:
|
|
311
258
|
_b.sent();
|
|
312
259
|
expect(getCommentsCount).toHaveBeenCalledWith({
|
|
313
260
|
uris: ['uri2'],
|
|
@@ -444,12 +391,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
444
391
|
replies: 2
|
|
445
392
|
}
|
|
446
393
|
];
|
|
447
|
-
|
|
448
|
-
getCommentsCount
|
|
449
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: comments }])
|
|
450
|
-
.mockResolvedValueOnce([
|
|
451
|
-
{ objectId: 'uri1', comments: __spreadArray(__spreadArray([], comments, true), [{ commentId: 'commentId', replies: 0, status: 'open' }], false) }
|
|
452
|
-
]);
|
|
394
|
+
getCommentsCount.mockResolvedValueOnce([{ objectId: 'uri1', comments: comments }]);
|
|
453
395
|
createComment.mockResolvedValueOnce([{ commentId: 'commentId' }]);
|
|
454
396
|
result = setUp().result;
|
|
455
397
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -467,16 +409,33 @@ describe('useCollaboration behaviour', function () {
|
|
|
467
409
|
expect(result.current.commentsMap).toEqual({ uri1: comments });
|
|
468
410
|
expect(result.current.currentComment).toBe(null);
|
|
469
411
|
expect(result.current.sending).toBe(false);
|
|
412
|
+
act(function () {
|
|
413
|
+
result.current.createComment({
|
|
414
|
+
content: 'content',
|
|
415
|
+
namedUsers: [],
|
|
416
|
+
objectType: 'entity',
|
|
417
|
+
relatedObjectUris: ['uri1'],
|
|
418
|
+
uri: 'uri1'
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
expect(result.current.sending).toBe(true);
|
|
422
|
+
expect(createComment).toHaveBeenCalledWith({
|
|
423
|
+
collaborationPath: '123',
|
|
424
|
+
tenant: 'alenat',
|
|
425
|
+
data: {
|
|
426
|
+
objectId: 'uri1',
|
|
427
|
+
content: 'content',
|
|
428
|
+
relatedObjectUris: ['uri1'],
|
|
429
|
+
objectType: 'entity',
|
|
430
|
+
visibility: 'public',
|
|
431
|
+
namedUsers: [],
|
|
432
|
+
permanentLink: 'https://tst-01.reltio.com/nui/alenat/profile?entityUri=entities%2F2jWtLtNc&commentId=%7BcommentId%7D'
|
|
433
|
+
}
|
|
434
|
+
});
|
|
470
435
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
471
436
|
return __generator(this, function (_a) {
|
|
472
437
|
switch (_a.label) {
|
|
473
|
-
case 0: return [4 /*yield*/,
|
|
474
|
-
content: 'content',
|
|
475
|
-
namedUsers: [],
|
|
476
|
-
objectType: 'entity',
|
|
477
|
-
relatedObjectUris: ['uri1'],
|
|
478
|
-
uri: 'uri1'
|
|
479
|
-
})];
|
|
438
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
480
439
|
case 1:
|
|
481
440
|
_a.sent();
|
|
482
441
|
return [2 /*return*/];
|
|
@@ -493,23 +452,15 @@ describe('useCollaboration behaviour', function () {
|
|
|
493
452
|
uri1: __spreadArray(__spreadArray([], comments, true), [{ commentId: 'commentId', replies: 0, status: 'open' }], false)
|
|
494
453
|
});
|
|
495
454
|
createComment.mockResolvedValueOnce([{ commentId: 'commentId2' }]);
|
|
496
|
-
getCommentsCount.mockResolvedValueOnce([
|
|
497
|
-
{ objectId: 'uri1', comments: __spreadArray(__spreadArray([], comments, true), [{ commentId: 'commentId', replies: 0, status: 'open' }], false) },
|
|
498
|
-
{ objectId: 'uri2', comments: [{ commentId: 'commentId2', replies: 0, status: 'open' }] }
|
|
499
|
-
]);
|
|
500
455
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
501
456
|
return __generator(this, function (_a) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
case 1:
|
|
510
|
-
_a.sent();
|
|
511
|
-
return [2 /*return*/];
|
|
512
|
-
}
|
|
457
|
+
result.current.createComment({
|
|
458
|
+
content: 'content',
|
|
459
|
+
namedUsers: [],
|
|
460
|
+
objectType: 'entity',
|
|
461
|
+
uri: 'uri2'
|
|
462
|
+
});
|
|
463
|
+
return [2 /*return*/];
|
|
513
464
|
});
|
|
514
465
|
}); })];
|
|
515
466
|
case 3:
|
|
@@ -538,14 +489,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
538
489
|
{ commentId: 'id1', content: 'first comment', status: 'open', replies: [] },
|
|
539
490
|
{ commentId: 'id2', content: 'second comment', status: 'open', replies: [] }
|
|
540
491
|
];
|
|
541
|
-
getCommentsCount
|
|
542
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }])
|
|
543
|
-
.mockResolvedValueOnce([
|
|
544
|
-
{ objectId: 'uri1', comments: [commentsCount[0], { commentId: 'id2', status: 'open', replies: 3 }] }
|
|
545
|
-
])
|
|
546
|
-
.mockResolvedValueOnce([
|
|
547
|
-
{ objectId: 'uri1', comments: [commentsCount[0], { commentId: 'id2', status: 'resolved', replies: 4 }] }
|
|
548
|
-
]);
|
|
492
|
+
getCommentsCount.mockResolvedValue([{ objectId: 'uri1', comments: commentsCount }]);
|
|
549
493
|
getComments.mockResolvedValue({ items: comments });
|
|
550
494
|
getComment.mockResolvedValueOnce({
|
|
551
495
|
commentId: 'id2',
|
|
@@ -678,11 +622,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
678
622
|
{ commentId: 'id1', status: 'open', content: 'first comment', replies: [] },
|
|
679
623
|
{ commentId: 'id2', status: 'open', content: 'second comment', replies: [] }
|
|
680
624
|
];
|
|
681
|
-
getCommentsCount
|
|
682
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }])
|
|
683
|
-
.mockResolvedValueOnce([
|
|
684
|
-
{ objectId: 'uri1', comments: [commentsCount[0], { commentId: 'id2', status: 'resolved', replies: 3 }] }
|
|
685
|
-
]);
|
|
625
|
+
getCommentsCount.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }]);
|
|
686
626
|
getComment.mockResolvedValueOnce({ commentId: 'id2', replies: [] });
|
|
687
627
|
getComments.mockResolvedValue({ items: comments });
|
|
688
628
|
createReply.mockResolvedValueOnce([{ content: '', action: 'resolve' }]);
|
|
@@ -755,11 +695,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
755
695
|
{ commentId: 'id1', status: 'open', content: 'first comment', replies: [] },
|
|
756
696
|
{ commentId: 'id2', status: 'open', content: 'second comment', replies: [] }
|
|
757
697
|
];
|
|
758
|
-
getCommentsCount
|
|
759
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }])
|
|
760
|
-
.mockResolvedValueOnce([
|
|
761
|
-
{ objectId: 'uri1', comments: [commentsCount[0], { commentId: 'id2', status: 'open', replies: 3 }] }
|
|
762
|
-
]);
|
|
698
|
+
getCommentsCount.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }]);
|
|
763
699
|
getComment.mockResolvedValueOnce({ commentId: 'id2', replies: [] });
|
|
764
700
|
getComments.mockResolvedValue({
|
|
765
701
|
items: comments
|
|
@@ -932,12 +868,9 @@ describe('useCollaboration behaviour', function () {
|
|
|
932
868
|
{ commentId: 'id1', content: 'text 1', status: 'open', replies: [] },
|
|
933
869
|
{ commentId: 'id2', content: 'text2', status: 'open', replies: [] }
|
|
934
870
|
];
|
|
935
|
-
expectedCommentsCount =
|
|
936
|
-
expectedComments =
|
|
937
|
-
|
|
938
|
-
getCommentsCount
|
|
939
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }])
|
|
940
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: expectedCommentsCount }]);
|
|
871
|
+
expectedCommentsCount = commentsCount.slice(1);
|
|
872
|
+
expectedComments = comments.slice(1);
|
|
873
|
+
getCommentsCount.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }]);
|
|
941
874
|
getComments.mockResolvedValueOnce({ items: comments });
|
|
942
875
|
deleteComment.mockResolvedValueOnce('');
|
|
943
876
|
result = setUp().result;
|
|
@@ -952,20 +885,28 @@ describe('useCollaboration behaviour', function () {
|
|
|
952
885
|
expect(result.current.comments).toEqual(comments);
|
|
953
886
|
expect(result.current.commentsMap).toEqual({ uri1: commentsCount });
|
|
954
887
|
expect(result.current.sending).toBe(false);
|
|
888
|
+
act(function () {
|
|
889
|
+
result.current.deleteComment({ commentId: 'id1', uri: 'uri1' });
|
|
890
|
+
});
|
|
891
|
+
expect(result.current.sending).toBe(true);
|
|
892
|
+
expect(deleteComment).toHaveBeenCalledWith({
|
|
893
|
+
collaborationPath: '123',
|
|
894
|
+
tenant: 'alenat',
|
|
895
|
+
commentId: 'id1'
|
|
896
|
+
});
|
|
955
897
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
956
898
|
return __generator(this, function (_a) {
|
|
957
|
-
|
|
958
|
-
|
|
899
|
+
switch (_a.label) {
|
|
900
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
901
|
+
case 1:
|
|
902
|
+
_a.sent();
|
|
903
|
+
return [2 /*return*/];
|
|
904
|
+
}
|
|
959
905
|
});
|
|
960
906
|
}); })];
|
|
961
907
|
case 2:
|
|
962
908
|
_a.sent();
|
|
963
909
|
expect(result.current.sending).toBe(false);
|
|
964
|
-
expect(deleteComment).toHaveBeenCalledWith({
|
|
965
|
-
collaborationPath: '123',
|
|
966
|
-
tenant: 'alenat',
|
|
967
|
-
commentId: 'id1'
|
|
968
|
-
});
|
|
969
910
|
expect(result.current.commentsMap).toEqual({
|
|
970
911
|
uri1: expectedCommentsCount
|
|
971
912
|
});
|
|
@@ -983,23 +924,13 @@ describe('useCollaboration behaviour', function () {
|
|
|
983
924
|
{ commentId: 'id1', status: 'open', replies: 1 },
|
|
984
925
|
{ commentId: 'id2', status: 'open', replies: 2 }
|
|
985
926
|
];
|
|
986
|
-
|
|
987
|
-
getCommentsCount
|
|
988
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }])
|
|
989
|
-
.mockResolvedValueOnce([
|
|
990
|
-
{ objectId: 'uri1', comments: [commentsCount[0], { commentId: 'id2', status: 'open', replies: 2 }] },
|
|
991
|
-
{ objectId: 'uri2', comments: [] }
|
|
992
|
-
]);
|
|
927
|
+
getCommentsCount.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }]);
|
|
993
928
|
createReply.mockResolvedValueOnce([{ content: 'reply message' }]);
|
|
994
929
|
result = setUp().result;
|
|
995
930
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
996
931
|
return __generator(this, function (_a) {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
case 1:
|
|
1000
|
-
_a.sent();
|
|
1001
|
-
return [2 /*return*/];
|
|
1002
|
-
}
|
|
932
|
+
Promise.resolve();
|
|
933
|
+
return [2 /*return*/];
|
|
1003
934
|
});
|
|
1004
935
|
}); })];
|
|
1005
936
|
case 1:
|
|
@@ -1016,9 +947,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
1016
947
|
uri: 'uri2'
|
|
1017
948
|
})];
|
|
1018
949
|
case 1:
|
|
1019
|
-
_a.sent();
|
|
1020
|
-
return [4 /*yield*/, Promise.resolve()];
|
|
1021
|
-
case 2:
|
|
1022
950
|
_a.sent();
|
|
1023
951
|
return [2 /*return*/];
|
|
1024
952
|
}
|
|
@@ -1045,23 +973,14 @@ describe('useCollaboration behaviour', function () {
|
|
|
1045
973
|
];
|
|
1046
974
|
expectedCommentsCount = [{ commentId: 'id1', status: 'open', replies: 0 }];
|
|
1047
975
|
expectedComments = [{ commentId: 'id1', content: 'text 1', status: 'open', replies: [] }];
|
|
1048
|
-
|
|
1049
|
-
getCommentsCount
|
|
1050
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }])
|
|
1051
|
-
.mockResolvedValueOnce([{ objectId: 'uri1', comments: expectedCommentsCount }]);
|
|
976
|
+
getCommentsCount.mockResolvedValueOnce([{ objectId: 'uri1', comments: commentsCount }]);
|
|
1052
977
|
getComments.mockResolvedValue({ items: comments });
|
|
1053
978
|
deleteReply.mockResolvedValueOnce('');
|
|
1054
979
|
result = setUp().result;
|
|
1055
980
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1056
981
|
return __generator(this, function (_a) {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
result.current.getComments('uri');
|
|
1060
|
-
return [4 /*yield*/, Promise.resolve()];
|
|
1061
|
-
case 1:
|
|
1062
|
-
_a.sent();
|
|
1063
|
-
return [2 /*return*/];
|
|
1064
|
-
}
|
|
982
|
+
result.current.getComments('uri');
|
|
983
|
+
return [2 /*return*/];
|
|
1065
984
|
});
|
|
1066
985
|
}); })];
|
|
1067
986
|
case 1:
|
|
@@ -1069,16 +988,24 @@ describe('useCollaboration behaviour', function () {
|
|
|
1069
988
|
expect(result.current.comments).toEqual(comments);
|
|
1070
989
|
expect(result.current.commentsMap).toEqual({ uri1: commentsCount });
|
|
1071
990
|
expect(result.current.sending).toBe(false);
|
|
991
|
+
act(function () {
|
|
992
|
+
result.current.deleteReply({
|
|
993
|
+
commentId: 'id1',
|
|
994
|
+
uri: 'uri1',
|
|
995
|
+
reply: comments[0].replies[0]
|
|
996
|
+
});
|
|
997
|
+
});
|
|
998
|
+
expect(result.current.sending).toBe(true);
|
|
999
|
+
expect(deleteReply).toHaveBeenCalledWith({
|
|
1000
|
+
collaborationPath: '123',
|
|
1001
|
+
tenant: 'alenat',
|
|
1002
|
+
commentId: 'id1',
|
|
1003
|
+
replyId: 'replyId1'
|
|
1004
|
+
});
|
|
1072
1005
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1073
1006
|
return __generator(this, function (_a) {
|
|
1074
1007
|
switch (_a.label) {
|
|
1075
|
-
case 0:
|
|
1076
|
-
result.current.deleteReply({
|
|
1077
|
-
commentId: 'id1',
|
|
1078
|
-
uri: 'uri1',
|
|
1079
|
-
reply: comments[0].replies[0]
|
|
1080
|
-
});
|
|
1081
|
-
return [4 /*yield*/, Promise.resolve()];
|
|
1008
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
1082
1009
|
case 1:
|
|
1083
1010
|
_a.sent();
|
|
1084
1011
|
return [2 /*return*/];
|
|
@@ -1088,12 +1015,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
1088
1015
|
case 2:
|
|
1089
1016
|
_a.sent();
|
|
1090
1017
|
expect(result.current.sending).toBe(false);
|
|
1091
|
-
expect(deleteReply).toHaveBeenCalledWith({
|
|
1092
|
-
collaborationPath: '123',
|
|
1093
|
-
tenant: 'alenat',
|
|
1094
|
-
commentId: 'id1',
|
|
1095
|
-
replyId: 'replyId1'
|
|
1096
|
-
});
|
|
1097
1018
|
expect(result.current.commentsMap).toEqual({
|
|
1098
1019
|
uri1: expectedCommentsCount
|
|
1099
1020
|
});
|
|
@@ -1125,7 +1046,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
1125
1046
|
updateReply.mockResolvedValueOnce(editedReply);
|
|
1126
1047
|
getComment.mockResolvedValueOnce(initialComment);
|
|
1127
1048
|
getComments.mockResolvedValueOnce({ items: initialComments });
|
|
1128
|
-
getTotalCommentsCount.mockResolvedValue({ total: 2 });
|
|
1129
1049
|
result = setUp().result;
|
|
1130
1050
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1131
1051
|
return __generator(this, function (_a) {
|
|
@@ -1182,7 +1102,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
1182
1102
|
return __generator(this, function (_a) {
|
|
1183
1103
|
switch (_a.label) {
|
|
1184
1104
|
case 0:
|
|
1185
|
-
getTotalCommentsCount.mockResolvedValue({ total: 1 });
|
|
1186
1105
|
result = setUp().result;
|
|
1187
1106
|
expect(result.current.getCommentState('attrUri', 'commentUri')).toEqual({});
|
|
1188
1107
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -1225,7 +1144,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
1225
1144
|
return __generator(this, function (_a) {
|
|
1226
1145
|
switch (_a.label) {
|
|
1227
1146
|
case 0:
|
|
1228
|
-
getTotalCommentsCount.mockResolvedValue({ total: 1 });
|
|
1229
1147
|
result = setUp().result;
|
|
1230
1148
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1231
1149
|
return __generator(this, function (_a) {
|
|
@@ -1262,7 +1180,6 @@ describe('useCollaboration behaviour', function () {
|
|
|
1262
1180
|
return __generator(this, function (_a) {
|
|
1263
1181
|
switch (_a.label) {
|
|
1264
1182
|
case 0:
|
|
1265
|
-
getTotalCommentsCount.mockResolvedValue({ total: 1 });
|
|
1266
1183
|
result = setUp().result;
|
|
1267
1184
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1268
1185
|
return __generator(this, function (_a) {
|
|
@@ -1326,13 +1243,37 @@ describe('useCollaboration behaviour', function () {
|
|
|
1326
1243
|
expect(result.current.totalCommentsCount).toBe(null);
|
|
1327
1244
|
expect(getTotalCommentsCount).not.toHaveBeenCalled();
|
|
1328
1245
|
});
|
|
1329
|
-
it('should call getTotalCommentsCount if collaboration is enabled
|
|
1246
|
+
it('should not call getTotalCommentsCount and update totalCommentsCount value if collaboration is enabled but needsTotalCount is false', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1247
|
+
return __generator(this, function (_a) {
|
|
1248
|
+
switch (_a.label) {
|
|
1249
|
+
case 0:
|
|
1250
|
+
getTotalCommentsCount.mockResolvedValueOnce({ total: 15 });
|
|
1251
|
+
setUp();
|
|
1252
|
+
expect(getTotalCommentsCount).not.toHaveBeenCalled();
|
|
1253
|
+
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1254
|
+
return __generator(this, function (_a) {
|
|
1255
|
+
switch (_a.label) {
|
|
1256
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
1257
|
+
case 1:
|
|
1258
|
+
_a.sent();
|
|
1259
|
+
return [2 /*return*/];
|
|
1260
|
+
}
|
|
1261
|
+
});
|
|
1262
|
+
}); })];
|
|
1263
|
+
case 1:
|
|
1264
|
+
_a.sent();
|
|
1265
|
+
expect(getTotalCommentsCount).not.toHaveBeenCalled();
|
|
1266
|
+
return [2 /*return*/];
|
|
1267
|
+
}
|
|
1268
|
+
});
|
|
1269
|
+
}); });
|
|
1270
|
+
it('should call getTotalCommentsCount and update totalCommentsCount value if collaboration is enabled and needsTotalCount is true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1330
1271
|
var result;
|
|
1331
1272
|
return __generator(this, function (_a) {
|
|
1332
1273
|
switch (_a.label) {
|
|
1333
1274
|
case 0:
|
|
1334
1275
|
getTotalCommentsCount.mockResolvedValueOnce({ total: 15 });
|
|
1335
|
-
result = setUp().result;
|
|
1276
|
+
result = setUp({ props: { needsTotalCount: true } }).result;
|
|
1336
1277
|
expect(getTotalCommentsCount).toHaveBeenCalledWith({
|
|
1337
1278
|
relatedObjectUri: '1',
|
|
1338
1279
|
collaborationPath: '123',
|
|
@@ -1361,7 +1302,7 @@ describe('useCollaboration behaviour', function () {
|
|
|
1361
1302
|
switch (_a.label) {
|
|
1362
1303
|
case 0:
|
|
1363
1304
|
getTotalCommentsCount.mockRejectedValueOnce(new Error('Network error'));
|
|
1364
|
-
result = setUp().result;
|
|
1305
|
+
result = setUp({ props: { needsTotalCount: true } }).result;
|
|
1365
1306
|
expect(getTotalCommentsCount).toHaveBeenCalled();
|
|
1366
1307
|
return [4 /*yield*/, act(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1367
1308
|
return __generator(this, function (_a) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2157",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
12
12
|
"@googlemaps/markerclusterer": "^2.5.3",
|
|
13
13
|
"@react-sigma/core": "3.4.0",
|
|
14
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
14
|
+
"@reltio/mdm-sdk": "^1.4.1977",
|
|
15
15
|
"@vis.gl/react-google-maps": "^1.3.0",
|
|
16
16
|
"d3-cloud": "^1.2.5",
|
|
17
17
|
"d3-geo": "^2.0.1",
|