|
1 | 1 | import { Model, UIPlugin } from "../../src"; |
2 | 2 | import { DEFAULT_REVISION_ID, MESSAGE_VERSION } from "../../src/constants"; |
3 | 3 | import { functionRegistry } from "../../src/functions"; |
4 | | -import { getDefaultCellHeight, range, toCartesian, toZone } from "../../src/helpers"; |
| 4 | +import { getDefaultCellHeight, range, toCartesian, toZone, zoneToXc } from "../../src/helpers"; |
5 | 5 | import { featurePluginRegistry } from "../../src/plugins"; |
6 | 6 | import { Command, CommandResult, CoreCommand, DataValidationCriterion } from "../../src/types"; |
7 | 7 | import { CollaborationMessage } from "../../src/types/collaborative/transport_service"; |
@@ -30,6 +30,7 @@ import { |
30 | 30 | selectCell, |
31 | 31 | setCellContent, |
32 | 32 | setStyle, |
| 33 | + unMerge, |
33 | 34 | undo, |
34 | 35 | ungroupHeaders, |
35 | 36 | } from "../test_helpers/commands_helpers"; |
@@ -380,6 +381,20 @@ describe("Multi users synchronisation", () => { |
380 | 381 | ); |
381 | 382 | }); |
382 | 383 |
|
| 384 | + test("concurrent overlapping and non overlapping merge operations", () => { |
| 385 | + const sheetId = alice.getters.getActiveSheetId(); |
| 386 | + merge(alice, "A2:A3"); |
| 387 | + merge(alice, "F1:F2"); |
| 388 | + network.concurrent(() => { |
| 389 | + merge(alice, "A1:A3, C1:C2"); |
| 390 | + unMerge(bob, "A2:A3, F1:F2"); |
| 391 | + }); |
| 392 | + expect([alice, bob, charlie]).toHaveSynchronizedValue( |
| 393 | + (user) => user.getters.getMerges(sheetId).map(zoneToXc), |
| 394 | + ["A1:A3", "C1:C2"] |
| 395 | + ); |
| 396 | + }); |
| 397 | + |
383 | 398 | test("Command not allowed is not dispatched to others users", () => { |
384 | 399 | const spy = jest.spyOn(network, "sendMessage"); |
385 | 400 | setCellContent(alice, "A1", "hello", "invalidSheetId"); |
|
0 commit comments