mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
FIx tests
This commit is contained in:
parent
63d53fc242
commit
5c1fc2f4fb
3 changed files with 45 additions and 32 deletions
|
@ -78,8 +78,8 @@ describe("elbow arrow segment move", () => {
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[110, 0],
|
[110, 0],
|
||||||
[110, 195.01],
|
[110, 200],
|
||||||
[190, 195.01],
|
[190, 200],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
mouse.reset();
|
mouse.reset();
|
||||||
|
@ -89,8 +89,8 @@ describe("elbow arrow segment move", () => {
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[110, 0],
|
[110, 0],
|
||||||
[110, 195.01],
|
[110, 200],
|
||||||
[190, 195.01],
|
[190, 200],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -201,8 +201,8 @@ describe("elbow arrow routing", () => {
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[45, 0],
|
[45, 0],
|
||||||
[45, 199.07],
|
[45, 206.55],
|
||||||
[90.07, 199.07],
|
[90, 206.55],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -255,8 +255,8 @@ describe("elbow arrow ui", () => {
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[45, 0],
|
[45, 0],
|
||||||
[45, 195.01],
|
[45, 200],
|
||||||
[90, 195.01],
|
[90, 200],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -293,11 +293,12 @@ describe("elbow arrow ui", () => {
|
||||||
".drag-input",
|
".drag-input",
|
||||||
) as HTMLInputElement;
|
) as HTMLInputElement;
|
||||||
UI.updateInput(inputAngle, String("40"));
|
UI.updateInput(inputAngle, String("40"));
|
||||||
console.log(JSON.stringify(h.elements))
|
|
||||||
expect(arrow.points.map((point) => point.map(Math.round))).toEqual([
|
expect(arrow.points.map((point) => point.map(Math.round))).toEqual([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[109, 0],
|
[35, 0],
|
||||||
[109, 152],
|
[35, 183],
|
||||||
|
[96, 183],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -511,12 +511,12 @@ describe("arrow element", () => {
|
||||||
)[0] as ExcalidrawElbowArrowElement;
|
)[0] as ExcalidrawElbowArrowElement;
|
||||||
|
|
||||||
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
|
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]);
|
UI.resize(rectangle, "se", [-200, -150]);
|
||||||
|
|
||||||
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
|
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", () => {
|
it("flips the fixed point binding on negative resize for group selection", () => {
|
||||||
|
@ -539,7 +539,7 @@ describe("arrow element", () => {
|
||||||
)[0] as ExcalidrawElbowArrowElement;
|
)[0] as ExcalidrawElbowArrowElement;
|
||||||
|
|
||||||
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
|
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]);
|
UI.resize([rectangle, arrow], "nw", [300, 350]);
|
||||||
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(0);
|
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(0);
|
||||||
|
|
|
@ -198,7 +198,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"fillStyle": "solid",
|
"fillStyle": "solid",
|
||||||
"frameId": null,
|
"frameId": null,
|
||||||
"groupIds": [],
|
"groupIds": [],
|
||||||
"height": "99.23572",
|
"height": "99.58947",
|
||||||
"id": "id172",
|
"id": "id172",
|
||||||
"index": "a2",
|
"index": "a2",
|
||||||
"isDeleted": false,
|
"isDeleted": false,
|
||||||
|
@ -212,8 +212,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"96.42891",
|
"99.58947",
|
||||||
"99.23572",
|
"99.58947",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"roughness": 1,
|
"roughness": 1,
|
||||||
|
@ -228,8 +228,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"type": "arrow",
|
"type": "arrow",
|
||||||
"updated": 1,
|
"updated": 1,
|
||||||
"version": 40,
|
"version": 40,
|
||||||
"width": "96.42891",
|
"width": "99.58947",
|
||||||
"x": "3.53553",
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -298,7 +298,7 @@ History {
|
||||||
"focus": "0.00990",
|
"focus": "0.00990",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"height": "0.92998",
|
"height": "0.92900",
|
||||||
"points": [
|
"points": [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
@ -306,7 +306,7 @@ History {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"-0.92998",
|
"-0.92900",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": {
|
"startBinding": {
|
||||||
|
@ -314,14 +314,15 @@ History {
|
||||||
"focus": "0.02970",
|
"focus": "0.02970",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
|
"width": "92.92893",
|
||||||
},
|
},
|
||||||
"inserted": {
|
"inserted": {
|
||||||
"endBinding": {
|
"endBinding": {
|
||||||
"elementId": "id171",
|
"elementId": "id171",
|
||||||
"focus": "-0.02000",
|
"focus": "-0.02052",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"height": "0.00611",
|
"height": "0.04625",
|
||||||
"points": [
|
"points": [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
@ -329,14 +330,15 @@ History {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"0.00611",
|
"0.04625",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": {
|
"startBinding": {
|
||||||
"elementId": "id170",
|
"elementId": "id170",
|
||||||
"focus": "0.02000",
|
"focus": "0.01841",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
|
"width": "92.92893",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -390,18 +392,20 @@ History {
|
||||||
"focus": 0,
|
"focus": 0,
|
||||||
"gap": 1,
|
"gap": 1,
|
||||||
},
|
},
|
||||||
"height": "99.23572",
|
"height": "99.58947",
|
||||||
"points": [
|
"points": [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"96.42891",
|
"99.58947",
|
||||||
"99.23572",
|
"99.58947",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": null,
|
"startBinding": null,
|
||||||
|
"width": "99.58947",
|
||||||
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
},
|
},
|
||||||
"inserted": {
|
"inserted": {
|
||||||
|
@ -410,7 +414,7 @@ History {
|
||||||
"focus": "0.00990",
|
"focus": "0.00990",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"height": "0.93503",
|
"height": "0.92678",
|
||||||
"points": [
|
"points": [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
@ -418,7 +422,7 @@ History {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"-0.93503",
|
"-0.92678",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": {
|
"startBinding": {
|
||||||
|
@ -426,7 +430,9 @@ History {
|
||||||
"focus": "0.02970",
|
"focus": "0.02970",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"y": "0.97365",
|
"width": "92.92893",
|
||||||
|
"x": "3.53553",
|
||||||
|
"y": "0.96071",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"id175" => Delta {
|
"id175" => Delta {
|
||||||
|
@ -858,6 +864,7 @@ History {
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
"width": 0,
|
||||||
},
|
},
|
||||||
"inserted": {
|
"inserted": {
|
||||||
"points": [
|
"points": [
|
||||||
|
@ -866,10 +873,11 @@ History {
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
100,
|
90,
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
"width": 90,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -926,6 +934,8 @@ History {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": null,
|
"startBinding": null,
|
||||||
|
"width": 100,
|
||||||
|
"x": 150,
|
||||||
},
|
},
|
||||||
"inserted": {
|
"inserted": {
|
||||||
"endBinding": {
|
"endBinding": {
|
||||||
|
@ -948,6 +958,8 @@ History {
|
||||||
"focus": 0,
|
"focus": 0,
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
|
"width": 0,
|
||||||
|
"x": "146.46447",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue