Fix all tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2025-08-16 20:54:16 +02:00
parent f7b5ccea8c
commit 12aa34d77f
2 changed files with 220 additions and 487 deletions

View File

@@ -143,7 +143,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 5, "version": 13,
"width": 100, "width": 100,
"x": -100, "x": -100,
"y": -50, "y": -50,
@@ -173,7 +173,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 4, "version": 9,
"width": 100, "width": 100,
"x": 100, "x": 100,
"y": -50, "y": -50,
@@ -188,11 +188,18 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"customData": undefined, "customData": undefined,
"elbowed": false, "elbowed": false,
"endArrowhead": "arrow", "endArrowhead": "arrow",
"endBinding": null, "endBinding": {
"elementId": "id15",
"fixedPoint": [
"0.50000",
1,
],
"mode": "orbit",
},
"fillStyle": "solid", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": "0.03787", "height": "113.98784",
"id": "id4", "id": "id4",
"index": "a2", "index": "a2",
"isDeleted": false, "isDeleted": false,
@@ -208,7 +215,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
[ [
95, 95,
"0.03787", "113.98784",
], ],
], ],
"roughness": 1, "roughness": 1,
@@ -222,23 +229,58 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
1, 1,
"0.50010", "0.50010",
], ],
"mode": "orbit", "mode": "inside",
}, },
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 16, "version": 37,
"width": 95, "width": 95,
"x": 5, "x": 0,
"y": "0.01199", "y": "0.01000",
} }
`; `;
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of elements 1`] = `3`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] element 3 1`] = `
{
"angle": 0,
"backgroundColor": "transparent",
"boundElements": [
{
"id": "id4",
"type": "arrow",
},
],
"customData": undefined,
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": 50,
"id": "id15",
"index": "a3",
"isDeleted": false,
"link": null,
"locked": false,
"opacity": 100,
"roughness": 1,
"roundness": null,
"strokeColor": "#1e1e1e",
"strokeStyle": "solid",
"strokeWidth": 2,
"type": "rectangle",
"updated": 1,
"version": 10,
"width": 50,
"x": 100,
"y": 100,
}
`;
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of renders 1`] = `12`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of elements 1`] = `4`;
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of renders 1`] = `21`;
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] redo stack 1`] = ` exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] redo stack 1`] = `
[ [
@@ -256,7 +298,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"id1": { "id1": {
"deleted": { "deleted": {
"boundElements": [], "boundElements": [],
"version": 4, "version": 9,
}, },
"inserted": { "inserted": {
"boundElements": [ "boundElements": [
@@ -265,13 +307,35 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow", "type": "arrow",
}, },
], ],
"version": 3, "version": 8,
},
},
"id15": {
"deleted": {
"boundElements": [
{
"id": "id4",
"type": "arrow",
},
],
"version": 9,
},
"inserted": {
"boundElements": [],
"version": 8,
}, },
}, },
"id4": { "id4": {
"deleted": { "deleted": {
"endBinding": null, "endBinding": {
"height": "0.88851", "elementId": "id15",
"fixedPoint": [
"0.50000",
1,
],
"mode": "orbit",
},
"height": "100.79596",
"points": [ "points": [
[ [
0, 0,
@@ -279,29 +343,30 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
[ [
90, 90,
"0.88851", "100.79596",
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id0", "elementId": "id0",
"fixedPoint": [ "fixedPoint": [
1, 1,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"version": 14, "version": 36,
"width": 90,
}, },
"inserted": { "inserted": {
"endBinding": { "endBinding": {
"elementId": "id1", "elementId": "id1",
"fixedPoint": [ "fixedPoint": [
0, 0,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"height": "0.00047", "height": "0.00000",
"points": [ "points": [
[ [
0, 0,
@@ -309,23 +374,24 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
[ [
90, 90,
"0.00047", "0.00000",
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id0", "elementId": "id0",
"fixedPoint": [ "fixedPoint": [
1, 1,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"version": 12, "version": 33,
"width": 90,
}, },
}, },
}, },
}, },
"id": "id17", "id": "id22",
}, },
{ {
"appState": AppStateDelta { "appState": AppStateDelta {
@@ -340,7 +406,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"updated": { "updated": {
"id4": { "id4": {
"deleted": { "deleted": {
"height": "0.03787", "height": "113.98784",
"points": [ "points": [
[ [
0, 0,
@@ -348,7 +414,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
[ [
95, 95,
"0.03787", "113.98784",
], ],
], ],
"startBinding": { "startBinding": {
@@ -357,13 +423,15 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
1, 1,
"0.50010", "0.50010",
], ],
"mode": "orbit", "mode": "inside",
}, },
"version": 16, "version": 37,
"width": 95, "width": 95,
"x": 0,
"y": "0.01000",
}, },
"inserted": { "inserted": {
"height": "0.88851", "height": "100.79596",
"points": [ "points": [
[ [
0, 0,
@@ -371,24 +439,26 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
], ],
[ [
90, 90,
"0.88851", "100.79596",
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id0", "elementId": "id0",
"fixedPoint": [ "fixedPoint": [
1, 1,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"version": 14, "version": 36,
"width": 90, "width": 90,
"x": 5,
"y": "15.52629",
}, },
}, },
}, },
}, },
"id": "id18", "id": "id23",
}, },
] ]
`; `;
@@ -570,136 +640,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
}, },
"id": "id6", "id": "id6",
}, },
{
"appState": AppStateDelta {
"delta": Delta {
"deleted": {},
"inserted": {},
},
},
"elements": {
"added": {},
"removed": {},
"updated": {
"id4": {
"deleted": {
"height": "0.95000",
"points": [
[
0,
0,
],
[
95,
"-0.95000",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 7,
"width": 95,
"x": 5,
"y": "0.95000",
},
"inserted": {
"height": 0,
"points": [
[
0,
0,
],
[
100,
0,
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 6,
"width": 100,
"x": 0,
"y": 0,
},
},
},
},
"id": "id9",
},
{
"appState": AppStateDelta {
"delta": Delta {
"deleted": {},
"inserted": {},
},
},
"elements": {
"added": {},
"removed": {},
"updated": {
"id4": {
"deleted": {
"height": "0.00950",
"points": [
[
0,
0,
],
[
95,
"-0.00950",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "orbit",
},
"version": 9,
"y": "0.00950",
},
"inserted": {
"height": "0.95000",
"points": [
[
0,
0,
],
[
95,
"-0.95000",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 7,
"y": "0.95000",
},
},
},
},
"id": "id11",
},
] ]
`; `;
@@ -846,9 +786,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 5, "version": 14,
"width": 100, "width": 100,
"x": -100, "x": 150,
"y": -50, "y": -50,
} }
`; `;
@@ -876,9 +816,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"updated": 1, "updated": 1,
"version": 4, "version": 9,
"width": 100, "width": 100,
"x": 100, "x": 150,
"y": -50, "y": -50,
} }
`; `;
@@ -895,7 +835,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid", "fillStyle": "solid",
"frameId": null, "frameId": null,
"groupIds": [], "groupIds": [],
"height": "0.88851", "height": "0.01000",
"id": "id4", "id": "id4",
"index": "a2", "index": "a2",
"isDeleted": false, "isDeleted": false,
@@ -910,8 +850,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
0, 0,
], ],
[ [
90, 0,
"0.88851", "-0.01000",
], ],
], ],
"roughness": 1, "roughness": 1,
@@ -925,23 +865,23 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
1, 1,
"0.50010", "0.50010",
], ],
"mode": "orbit", "mode": "inside",
}, },
"strokeColor": "#1e1e1e", "strokeColor": "#1e1e1e",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 2,
"type": "arrow", "type": "arrow",
"updated": 1, "updated": 1,
"version": 18, "version": 30,
"width": 90, "width": 0,
"x": 5, "x": 250,
"y": "0.05936", "y": "0.01000",
} }
`; `;
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of elements 1`] = `3`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of elements 1`] = `3`;
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of renders 1`] = `14`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of renders 1`] = `23`;
exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] redo stack 1`] = ` exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] redo stack 1`] = `
[ [
@@ -959,7 +899,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"id1": { "id1": {
"deleted": { "deleted": {
"boundElements": [], "boundElements": [],
"version": 4, "version": 9,
}, },
"inserted": { "inserted": {
"boundElements": [ "boundElements": [
@@ -968,62 +908,66 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow", "type": "arrow",
}, },
], ],
"version": 3, "version": 8,
}, },
}, },
"id4": { "id4": {
"deleted": { "deleted": {
"endBinding": null, "endBinding": null,
"height": "0.00900", "height": "3.00000",
"points": [ "points": [
[ [
0, 0,
0, 0,
], ],
[ [
90, -45,
"-0.00900", "-3.00000",
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id0", "elementId": "id0",
"fixedPoint": [ "fixedPoint": [
1, 1,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"version": 16, "version": 29,
"width": 45,
"y": "3.00000",
}, },
"inserted": { "inserted": {
"endBinding": { "endBinding": {
"elementId": "id1", "elementId": "id1",
"fixedPoint": [ "fixedPoint": [
0, 0,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"height": "0.04676", "height": 0,
"points": [ "points": [
[ [
0, 0,
0, 0,
], ],
[ [
90, 0,
"-0.04676", 0,
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id0", "elementId": "id0",
"fixedPoint": [ "fixedPoint": [
1, 1,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"version": 14, "version": 28,
"width": 0,
"y": "9.99861",
}, },
}, },
}, },
@@ -1043,15 +987,15 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"updated": { "updated": {
"id4": { "id4": {
"deleted": { "deleted": {
"height": "0.88851", "height": "0.01000",
"points": [ "points": [
[ [
0, 0,
0, 0,
], ],
[ [
90, 0,
"0.88851", "-0.01000",
], ],
], ],
"startBinding": { "startBinding": {
@@ -1060,33 +1004,37 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
1, 1,
"0.50010", "0.50010",
], ],
"mode": "orbit", "mode": "inside",
}, },
"version": 18, "version": 30,
"y": "0.05936", "width": 0,
"x": 250,
"y": "0.01000",
}, },
"inserted": { "inserted": {
"height": "0.00900", "height": "3.00000",
"points": [ "points": [
[ [
0, 0,
0, 0,
], ],
[ [
90, -45,
"-0.00900", "-3.00000",
], ],
], ],
"startBinding": { "startBinding": {
"elementId": "id0", "elementId": "id0",
"fixedPoint": [ "fixedPoint": [
1, 1,
"0.50010", "0.60000",
], ],
"mode": "orbit", "mode": "orbit",
}, },
"version": 16, "version": 29,
"y": "0.00950", "width": 45,
"x": 145,
"y": "3.00000",
}, },
}, },
}, },
@@ -1273,262 +1221,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
}, },
"id": "id6", "id": "id6",
}, },
{
"appState": AppStateDelta {
"delta": Delta {
"deleted": {},
"inserted": {},
},
},
"elements": {
"added": {},
"removed": {},
"updated": {
"id4": {
"deleted": {
"height": "0.95000",
"points": [
[
0,
0,
],
[
95,
"-0.95000",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 7,
"width": 95,
"x": 5,
"y": "0.95000",
},
"inserted": {
"height": 0,
"points": [
[
0,
0,
],
[
100,
0,
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 6,
"width": 100,
"x": 0,
"y": 0,
},
},
},
},
"id": "id9",
},
{
"appState": AppStateDelta {
"delta": Delta {
"deleted": {},
"inserted": {},
},
},
"elements": {
"added": {},
"removed": {},
"updated": {
"id4": {
"deleted": {
"height": 0,
"points": [
[
0,
0,
],
[
95,
0,
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 8,
"y": 0,
},
"inserted": {
"height": "0.95000",
"points": [
[
0,
0,
],
[
95,
"-0.95000",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 7,
"y": "0.95000",
},
},
},
},
"id": "id11",
},
{
"appState": AppStateDelta {
"delta": Delta {
"deleted": {},
"inserted": {},
},
},
"elements": {
"added": {},
"removed": {},
"updated": {
"id4": {
"deleted": {
"height": "0.00950",
"points": [
[
0,
0,
],
[
95,
"-0.00950",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "orbit",
},
"version": 10,
"y": "0.00950",
},
"inserted": {
"height": 0,
"points": [
[
0,
0,
],
[
95,
0,
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "inside",
},
"version": 8,
"y": 0,
},
},
},
},
"id": "id13",
},
{
"appState": AppStateDelta {
"delta": Delta {
"deleted": {},
"inserted": {},
},
},
"elements": {
"added": {},
"removed": {},
"updated": {
"id4": {
"deleted": {
"height": "0.93837",
"points": [
[
0,
0,
],
[
90,
"0.93837",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "orbit",
},
"version": 11,
"width": 90,
},
"inserted": {
"height": "0.00950",
"points": [
[
0,
0,
],
[
95,
"-0.00950",
],
],
"startBinding": {
"elementId": "id0",
"fixedPoint": [
1,
"0.50010",
],
"mode": "orbit",
},
"version": 10,
"width": 95,
},
},
},
},
"id": "id16",
},
] ]
`; `;

View File

@@ -4558,16 +4558,30 @@ describe("history", () => {
// create start binding // create start binding
mouse.downAt(0, 0); mouse.downAt(0, 0);
mouse.moveTo(0, 1); mouse.moveTo(0, 10);
mouse.moveTo(0, 0); mouse.moveTo(0, 10);
mouse.up(); mouse.up();
// create end binding // create end binding
mouse.downAt(100, 0); mouse.downAt(100, 0);
mouse.moveTo(100, 1); mouse.moveTo(100, 10);
mouse.moveTo(100, 0); mouse.moveTo(100, 10);
mouse.up(); mouse.up();
expect(
(h.elements[2] as ExcalidrawElbowArrowElement).startBinding
?.fixedPoint,
).not.toEqual([1, 0.5001]);
expect(
(h.elements[2] as ExcalidrawElbowArrowElement).startBinding?.mode,
).toBe("orbit");
expect(
(h.elements[2] as ExcalidrawElbowArrowElement).endBinding,
).not.toEqual([1, 0.5001]);
expect(
(h.elements[2] as ExcalidrawElbowArrowElement).endBinding?.mode,
).toBe("orbit");
expect(h.elements).toEqual( expect(h.elements).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
@@ -4607,12 +4621,16 @@ describe("history", () => {
expect(h.elements).toEqual([ expect(h.elements).toEqual([
expect.objectContaining({ expect.objectContaining({
id: rect1.id, id: rect1.id,
boundElements: [], boundElements: [{ id: arrowId, type: "arrow" }],
}), }),
expect.objectContaining({ id: rect2.id, boundElements: [] }), expect.objectContaining({ id: rect2.id, boundElements: [] }),
expect.objectContaining({ expect.objectContaining({
id: arrowId, id: arrowId,
startBinding: null, startBinding: expect.objectContaining({
elementId: rect1.id,
fixedPoint: [1, 0.5001],
mode: "inside",
}),
endBinding: null, endBinding: null,
}), }),
]); ]);
@@ -4657,13 +4675,13 @@ describe("history", () => {
id: arrowId, id: arrowId,
startBinding: expect.objectContaining({ startBinding: expect.objectContaining({
elementId: rect1.id, elementId: rect1.id,
focus: expect.toBeNonNaNNumber(), fixedPoint: [1, 0.6],
gap: expect.toBeNonNaNNumber(), mode: "orbit",
}), }),
endBinding: expect.objectContaining({ endBinding: expect.objectContaining({
elementId: rect2.id, elementId: rect2.id,
focus: expect.toBeNonNaNNumber(), fixedPoint: [0, 0.6],
gap: expect.toBeNonNaNNumber(), mode: "orbit",
}), }),
}), }),
]), ]),
@@ -4676,12 +4694,21 @@ describe("history", () => {
expect(h.elements).toEqual([ expect(h.elements).toEqual([
expect.objectContaining({ expect.objectContaining({
id: rect1.id, id: rect1.id,
boundElements: [], boundElements: [
expect.objectContaining({
id: arrowId,
type: "arrow",
}),
],
}), }),
expect.objectContaining({ id: rect2.id, boundElements: [] }), expect.objectContaining({ id: rect2.id, boundElements: [] }),
expect.objectContaining({ expect.objectContaining({
id: arrowId, id: arrowId,
startBinding: null, startBinding: expect.objectContaining({
elementId: rect1.id,
fixedPoint: [1, 0.5001],
mode: "inside",
}),
endBinding: null, endBinding: null,
}), }),
]); ]);
@@ -4700,13 +4727,13 @@ describe("history", () => {
// create start binding // create start binding
mouse.downAt(0, 0); mouse.downAt(0, 0);
mouse.moveTo(0, 1); mouse.moveTo(0, 10);
mouse.upAt(0, 0); mouse.upAt(0, 10);
// create end binding // create end binding
mouse.downAt(100, 0); mouse.downAt(100, 0);
mouse.moveTo(100, 1); mouse.moveTo(100, 10);
mouse.upAt(100, 0); mouse.upAt(100, 10);
expect(h.elements).toEqual( expect(h.elements).toEqual(
expect.arrayContaining([ expect.arrayContaining([
@@ -4747,12 +4774,21 @@ describe("history", () => {
expect(h.elements).toEqual([ expect(h.elements).toEqual([
expect.objectContaining({ expect.objectContaining({
id: rect1.id, id: rect1.id,
boundElements: [], boundElements: [
expect.objectContaining({
id: arrowId,
type: "arrow",
}),
],
}), }),
expect.objectContaining({ id: rect2.id, boundElements: [] }), expect.objectContaining({ id: rect2.id, boundElements: [] }),
expect.objectContaining({ expect.objectContaining({
id: arrowId, id: arrowId,
startBinding: null, startBinding: expect.objectContaining({
elementId: rect1.id,
fixedPoint: [1, 0.5001],
mode: "inside",
}),
endBinding: null, endBinding: null,
}), }),
]); ]);
@@ -4800,14 +4836,14 @@ describe("history", () => {
id: arrowId, id: arrowId,
startBinding: expect.objectContaining({ startBinding: expect.objectContaining({
elementId: rect1.id, elementId: rect1.id,
focus: expect.toBeNonNaNNumber(), fixedPoint: [1, 0.6],
gap: expect.toBeNonNaNNumber(), mode: "orbit",
}), }),
// rebound with previous rectangle // rebound with previous rectangle
endBinding: expect.objectContaining({ endBinding: expect.objectContaining({
elementId: rect2.id, elementId: rect2.id,
focus: expect.toBeNonNaNNumber(), fixedPoint: [0, 0.6],
gap: expect.toBeNonNaNNumber(), mode: "orbit",
}), }),
}), }),
expect.objectContaining({ expect.objectContaining({
@@ -4825,7 +4861,12 @@ describe("history", () => {
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
id: rect1.id, id: rect1.id,
boundElements: [], boundElements: [
expect.objectContaining({
id: arrowId,
type: "arrow",
}),
],
}), }),
expect.objectContaining({ expect.objectContaining({
id: rect2.id, id: rect2.id,
@@ -4833,16 +4874,16 @@ describe("history", () => {
}), }),
expect.objectContaining({ expect.objectContaining({
id: arrowId, id: arrowId,
startBinding: null, startBinding: expect.objectContaining({
elementId: rect1.id,
fixedPoint: [1, 0.5001],
mode: "inside",
}),
endBinding: expect.objectContaining({ endBinding: expect.objectContaining({
// now we are back in the previous state! // now we are back in the previous state!
elementId: remoteContainer.id, elementId: remoteContainer.id,
fixedPoint: [ fixedPoint: [0.5, 1],
expect.toBeNonNaNNumber(), mode: "orbit",
expect.toBeNonNaNNumber(),
],
focus: expect.toBeNonNaNNumber(),
gap: expect.toBeNonNaNNumber(),
}), }),
}), }),
expect.objectContaining({ expect.objectContaining({