mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
8c9666b8ab
commit
528e6aa2df
5 changed files with 59 additions and 58 deletions
|
@ -77,9 +77,9 @@ describe("elbow arrow segment move", () => {
|
||||||
|
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[110, 0],
|
[107.93, 0],
|
||||||
[110, 200],
|
[107.93, 185.86],
|
||||||
[190, 200],
|
[185.86, 185.86],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
mouse.reset();
|
mouse.reset();
|
||||||
|
@ -88,9 +88,9 @@ describe("elbow arrow segment move", () => {
|
||||||
|
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[110, 0],
|
[107.93, 0],
|
||||||
[110, 200],
|
[107.93, 185.86],
|
||||||
[190, 200],
|
[185.86, 185.86],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -200,9 +200,9 @@ describe("elbow arrow routing", () => {
|
||||||
|
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[45, 0],
|
[42.93, 0],
|
||||||
[45, 206.55],
|
[42.93, 195.7],
|
||||||
[90, 206.55],
|
[85.86, 195.7],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -254,9 +254,9 @@ describe("elbow arrow ui", () => {
|
||||||
expect(arrow.elbowed).toBe(true);
|
expect(arrow.elbowed).toBe(true);
|
||||||
expect(arrow.points).toCloselyEqualPoints([
|
expect(arrow.points).toCloselyEqualPoints([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[45, 0],
|
[42.93, 0],
|
||||||
[45, 200],
|
[42.93, 153.48],
|
||||||
[90, 200],
|
[85.86, 153.48],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -296,9 +296,8 @@ describe("elbow arrow ui", () => {
|
||||||
|
|
||||||
expect(arrow.points.map((point) => point.map(Math.round))).toEqual([
|
expect(arrow.points.map((point) => point.map(Math.round))).toEqual([
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[35, 0],
|
[129, 0],
|
||||||
[35, 183],
|
[129, 131],
|
||||||
[96, 183],
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -510,13 +510,13 @@ describe("arrow element", () => {
|
||||||
h.state,
|
h.state,
|
||||||
)[0] as ExcalidrawElbowArrowElement;
|
)[0] as ExcalidrawElbowArrowElement;
|
||||||
|
|
||||||
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
|
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.07);
|
||||||
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
|
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.86);
|
||||||
|
|
||||||
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.07);
|
||||||
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
|
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.86);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("flips the fixed point binding on negative resize for group selection", () => {
|
it("flips the fixed point binding on negative resize for group selection", () => {
|
||||||
|
@ -538,8 +538,8 @@ describe("arrow element", () => {
|
||||||
h.state,
|
h.state,
|
||||||
)[0] as ExcalidrawElbowArrowElement;
|
)[0] as ExcalidrawElbowArrowElement;
|
||||||
|
|
||||||
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
|
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.07);
|
||||||
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
|
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.86);
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -298,7 +298,7 @@ History {
|
||||||
"focus": "0.00990",
|
"focus": "0.00990",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"height": "0.92900",
|
"height": "0.92929",
|
||||||
"points": [
|
"points": [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
@ -306,7 +306,7 @@ History {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"-0.92900",
|
"-0.92929",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": {
|
"startBinding": {
|
||||||
|
@ -319,10 +319,10 @@ History {
|
||||||
"inserted": {
|
"inserted": {
|
||||||
"endBinding": {
|
"endBinding": {
|
||||||
"elementId": "id171",
|
"elementId": "id171",
|
||||||
"focus": "-0.02052",
|
"focus": "-0.02075",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"height": "0.04625",
|
"height": "0.07074",
|
||||||
"points": [
|
"points": [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
@ -330,12 +330,12 @@ History {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"0.04625",
|
"0.07074",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": {
|
"startBinding": {
|
||||||
"elementId": "id170",
|
"elementId": "id170",
|
||||||
"focus": "0.01841",
|
"focus": "0.01770",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"width": "92.92893",
|
"width": "92.92893",
|
||||||
|
@ -414,7 +414,7 @@ History {
|
||||||
"focus": "0.00990",
|
"focus": "0.00990",
|
||||||
"gap": 5,
|
"gap": 5,
|
||||||
},
|
},
|
||||||
"height": "0.92678",
|
"height": "0.92929",
|
||||||
"points": [
|
"points": [
|
||||||
[
|
[
|
||||||
0,
|
0,
|
||||||
|
@ -422,7 +422,7 @@ History {
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"-0.92678",
|
"-0.92929",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"startBinding": {
|
"startBinding": {
|
||||||
|
@ -432,7 +432,7 @@ History {
|
||||||
},
|
},
|
||||||
"width": "92.92893",
|
"width": "92.92893",
|
||||||
"x": "3.53553",
|
"x": "3.53553",
|
||||||
"y": "0.96071",
|
"y": "0.96033",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"id175" => Delta {
|
"id175" => Delta {
|
||||||
|
@ -873,11 +873,11 @@ History {
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
90,
|
"85.85786",
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"width": 90,
|
"width": "85.85786",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1253,7 +1253,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"fillStyle": "solid",
|
"fillStyle": "solid",
|
||||||
"frameId": null,
|
"frameId": null,
|
||||||
"groupIds": [],
|
"groupIds": [],
|
||||||
"height": "2.98409",
|
"height": "1.71911",
|
||||||
"id": "id178",
|
"id": "id178",
|
||||||
"index": "Zz",
|
"index": "Zz",
|
||||||
"isDeleted": false,
|
"isDeleted": false,
|
||||||
|
@ -1268,7 +1268,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"-2.98409",
|
"1.71911",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"roughness": 1,
|
"roughness": 1,
|
||||||
|
@ -1293,7 +1293,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"version": 11,
|
"version": 11,
|
||||||
"width": "92.92893",
|
"width": "92.92893",
|
||||||
"x": "3.53553",
|
"x": "3.53553",
|
||||||
"y": "4.70319",
|
"y": 0,
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -1625,7 +1625,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"fillStyle": "solid",
|
"fillStyle": "solid",
|
||||||
"frameId": null,
|
"frameId": null,
|
||||||
"groupIds": [],
|
"groupIds": [],
|
||||||
"height": "2.98409",
|
"height": "1.71911",
|
||||||
"id": "id181",
|
"id": "id181",
|
||||||
"index": "a0",
|
"index": "a0",
|
||||||
"isDeleted": false,
|
"isDeleted": false,
|
||||||
|
@ -1640,7 +1640,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"92.92893",
|
"92.92893",
|
||||||
"-2.98409",
|
"1.71911",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"roughness": 1,
|
"roughness": 1,
|
||||||
|
@ -1665,7 +1665,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"version": 11,
|
"version": 11,
|
||||||
"width": "92.92893",
|
"width": "92.92893",
|
||||||
"x": "3.53553",
|
"x": "3.53553",
|
||||||
"y": "4.70319",
|
"y": 0,
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -1783,7 +1783,7 @@ History {
|
||||||
"fillStyle": "solid",
|
"fillStyle": "solid",
|
||||||
"frameId": null,
|
"frameId": null,
|
||||||
"groupIds": [],
|
"groupIds": [],
|
||||||
"height": "22.46459",
|
"height": "12.86717",
|
||||||
"index": "a0",
|
"index": "a0",
|
||||||
"isDeleted": false,
|
"isDeleted": false,
|
||||||
"lastCommittedPoint": null,
|
"lastCommittedPoint": null,
|
||||||
|
@ -1796,8 +1796,8 @@ History {
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"93.46683",
|
"92.92893",
|
||||||
"-22.46459",
|
"12.86717",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"roughness": 1,
|
"roughness": 1,
|
||||||
|
@ -1818,9 +1818,9 @@ History {
|
||||||
"strokeStyle": "solid",
|
"strokeStyle": "solid",
|
||||||
"strokeWidth": 2,
|
"strokeWidth": 2,
|
||||||
"type": "arrow",
|
"type": "arrow",
|
||||||
"width": "93.46683",
|
"width": "92.92893",
|
||||||
"x": "2.99764",
|
"x": "3.53553",
|
||||||
"y": "35.33176",
|
"y": 0,
|
||||||
},
|
},
|
||||||
"inserted": {
|
"inserted": {
|
||||||
"isDeleted": true,
|
"isDeleted": true,
|
||||||
|
@ -2338,7 +2338,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"fillStyle": "solid",
|
"fillStyle": "solid",
|
||||||
"frameId": null,
|
"frameId": null,
|
||||||
"groupIds": [],
|
"groupIds": [],
|
||||||
"height": "408.02337",
|
"height": "369.21589",
|
||||||
"id": "id186",
|
"id": "id186",
|
||||||
"index": "a2",
|
"index": "a2",
|
||||||
"isDeleted": false,
|
"isDeleted": false,
|
||||||
|
@ -2352,8 +2352,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"495.48945",
|
"496.84035",
|
||||||
"-408.02337",
|
"-369.21589",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"roughness": 1,
|
"roughness": 1,
|
||||||
|
@ -2372,9 +2372,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"type": "arrow",
|
"type": "arrow",
|
||||||
"updated": 1,
|
"updated": 1,
|
||||||
"version": 10,
|
"version": 10,
|
||||||
"width": "495.48945",
|
"width": "496.84035",
|
||||||
"x": "3.53553",
|
"x": "2.18463",
|
||||||
"y": 0,
|
"y": "-38.80748",
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||||
"fillStyle": "solid",
|
"fillStyle": "solid",
|
||||||
"frameId": null,
|
"frameId": null,
|
||||||
"groupIds": [],
|
"groupIds": [],
|
||||||
"height": "87.97595",
|
"height": "94.40997",
|
||||||
"id": "id2",
|
"id": "id2",
|
||||||
"index": "a2",
|
"index": "a2",
|
||||||
"isDeleted": false,
|
"isDeleted": false,
|
||||||
|
@ -210,8 +210,8 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"87.46447",
|
"93.92893",
|
||||||
"87.97595",
|
"94.40997",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
"roughness": 1,
|
"roughness": 1,
|
||||||
|
@ -232,8 +232,8 @@ exports[`move element > rectangles with binding arrow 7`] = `
|
||||||
"updated": 1,
|
"updated": 1,
|
||||||
"version": 11,
|
"version": 11,
|
||||||
"versionNonce": 1051383431,
|
"versionNonce": 1051383431,
|
||||||
"width": "87.46447",
|
"width": "93.92893",
|
||||||
"x": 110,
|
"x": "103.53553",
|
||||||
"y": 50,
|
"y": "43.53553",
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -128,8 +128,10 @@ describe("move element", () => {
|
||||||
expect(h.state.selectedElementIds[rectB.id]).toBeTruthy();
|
expect(h.state.selectedElementIds[rectB.id]).toBeTruthy();
|
||||||
expect([rectA.x, rectA.y]).toEqual([0, 0]);
|
expect([rectA.x, rectA.y]).toEqual([0, 0]);
|
||||||
expect([rectB.x, rectB.y]).toEqual([201, 2]);
|
expect([rectB.x, rectB.y]).toEqual([201, 2]);
|
||||||
expect([[arrow.x, arrow.y]]).toCloselyEqualPoints([[107.07, 47.07]]);
|
expect([[arrow.x, arrow.y]]).toCloselyEqualPoints([[103.54, 43.53]]);
|
||||||
expect([[arrow.width, arrow.height]]).toCloselyEqualPoints([[86.86, 87.3]]);
|
expect([[arrow.width, arrow.height]]).toCloselyEqualPoints([
|
||||||
|
[93.93, 94.41],
|
||||||
|
]);
|
||||||
|
|
||||||
h.elements.forEach((element) => expect(element).toMatchSnapshot());
|
h.elements.forEach((element) => expect(element).toMatchSnapshot());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue