FIx tests

This commit is contained in:
Mark Tolmacs 2025-03-02 16:32:29 +01:00
parent 63d53fc242
commit 5c1fc2f4fb
3 changed files with 45 additions and 32 deletions

View file

@ -78,8 +78,8 @@ describe("elbow arrow segment move", () => {
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[110, 0],
[110, 195.01],
[190, 195.01],
[110, 200],
[190, 200],
]);
mouse.reset();
@ -89,8 +89,8 @@ describe("elbow arrow segment move", () => {
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[110, 0],
[110, 195.01],
[190, 195.01],
[110, 200],
[190, 200],
]);
});
@ -201,8 +201,8 @@ describe("elbow arrow routing", () => {
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[45, 0],
[45, 199.07],
[90.07, 199.07],
[45, 206.55],
[90, 206.55],
]);
});
});
@ -255,8 +255,8 @@ describe("elbow arrow ui", () => {
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[45, 0],
[45, 195.01],
[90, 195.01],
[45, 200],
[90, 200],
]);
});
@ -293,11 +293,12 @@ describe("elbow arrow ui", () => {
".drag-input",
) as HTMLInputElement;
UI.updateInput(inputAngle, String("40"));
console.log(JSON.stringify(h.elements))
expect(arrow.points.map((point) => point.map(Math.round))).toEqual([
[0, 0],
[109, 0],
[109, 152],
[35, 0],
[35, 183],
[96, 183],
]);
});

View file

@ -511,12 +511,12 @@ describe("arrow element", () => {
)[0] as ExcalidrawElbowArrowElement;
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.78);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
UI.resize(rectangle, "se", [-200, -150]);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.78);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
});
it("flips the fixed point binding on negative resize for group selection", () => {
@ -539,7 +539,7 @@ describe("arrow element", () => {
)[0] as ExcalidrawElbowArrowElement;
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.78);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
UI.resize([rectangle, arrow], "nw", [300, 350]);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(0);

View file

@ -198,7 +198,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": "99.23572",
"height": "99.58947",
"id": "id172",
"index": "a2",
"isDeleted": false,
@ -212,8 +212,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
0,
],
[
"96.42891",
"99.23572",
"99.58947",
"99.58947",
],
],
"roughness": 1,
@ -228,8 +228,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow",
"updated": 1,
"version": 40,
"width": "96.42891",
"x": "3.53553",
"width": "99.58947",
"x": 0,
"y": 0,
}
`;
@ -298,7 +298,7 @@ History {
"focus": "0.00990",
"gap": 5,
},
"height": "0.92998",
"height": "0.92900",
"points": [
[
0,
@ -306,7 +306,7 @@ History {
],
[
"92.92893",
"-0.92998",
"-0.92900",
],
],
"startBinding": {
@ -314,14 +314,15 @@ History {
"focus": "0.02970",
"gap": 5,
},
"width": "92.92893",
},
"inserted": {
"endBinding": {
"elementId": "id171",
"focus": "-0.02000",
"focus": "-0.02052",
"gap": 5,
},
"height": "0.00611",
"height": "0.04625",
"points": [
[
0,
@ -329,14 +330,15 @@ History {
],
[
"92.92893",
"0.00611",
"0.04625",
],
],
"startBinding": {
"elementId": "id170",
"focus": "0.02000",
"focus": "0.01841",
"gap": 5,
},
"width": "92.92893",
},
},
},
@ -390,18 +392,20 @@ History {
"focus": 0,
"gap": 1,
},
"height": "99.23572",
"height": "99.58947",
"points": [
[
0,
0,
],
[
"96.42891",
"99.23572",
"99.58947",
"99.58947",
],
],
"startBinding": null,
"width": "99.58947",
"x": 0,
"y": 0,
},
"inserted": {
@ -410,7 +414,7 @@ History {
"focus": "0.00990",
"gap": 5,
},
"height": "0.93503",
"height": "0.92678",
"points": [
[
0,
@ -418,7 +422,7 @@ History {
],
[
"92.92893",
"-0.93503",
"-0.92678",
],
],
"startBinding": {
@ -426,7 +430,9 @@ History {
"focus": "0.02970",
"gap": 5,
},
"y": "0.97365",
"width": "92.92893",
"x": "3.53553",
"y": "0.96071",
},
},
"id175" => Delta {
@ -858,6 +864,7 @@ History {
0,
],
],
"width": 0,
},
"inserted": {
"points": [
@ -866,10 +873,11 @@ History {
0,
],
[
100,
90,
0,
],
],
"width": 90,
},
},
},
@ -926,6 +934,8 @@ History {
],
],
"startBinding": null,
"width": 100,
"x": 150,
},
"inserted": {
"endBinding": {
@ -948,6 +958,8 @@ History {
"focus": 0,
"gap": 5,
},
"width": 0,
"x": "146.46447",
},
},
},