Fix tests

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2025-03-06 12:24:48 +01:00
parent 8c9666b8ab
commit 528e6aa2df
5 changed files with 59 additions and 58 deletions

View file

@ -77,9 +77,9 @@ describe("elbow arrow segment move", () => {
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[110, 0],
[110, 200],
[190, 200],
[107.93, 0],
[107.93, 185.86],
[185.86, 185.86],
]);
mouse.reset();
@ -88,9 +88,9 @@ describe("elbow arrow segment move", () => {
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[110, 0],
[110, 200],
[190, 200],
[107.93, 0],
[107.93, 185.86],
[185.86, 185.86],
]);
});
@ -200,9 +200,9 @@ describe("elbow arrow routing", () => {
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[45, 0],
[45, 206.55],
[90, 206.55],
[42.93, 0],
[42.93, 195.7],
[85.86, 195.7],
]);
});
});
@ -254,9 +254,9 @@ describe("elbow arrow ui", () => {
expect(arrow.elbowed).toBe(true);
expect(arrow.points).toCloselyEqualPoints([
[0, 0],
[45, 0],
[45, 200],
[90, 200],
[42.93, 0],
[42.93, 153.48],
[85.86, 153.48],
]);
});
@ -296,9 +296,8 @@ describe("elbow arrow ui", () => {
expect(arrow.points.map((point) => point.map(Math.round))).toEqual([
[0, 0],
[35, 0],
[35, 183],
[96, 183],
[129, 0],
[129, 131],
]);
});

View file

@ -510,13 +510,13 @@ describe("arrow element", () => {
h.state,
)[0] as ExcalidrawElbowArrowElement;
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.07);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.86);
UI.resize(rectangle, "se", [-200, -150]);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.07);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.86);
});
it("flips the fixed point binding on negative resize for group selection", () => {
@ -538,8 +538,8 @@ describe("arrow element", () => {
h.state,
)[0] as ExcalidrawElbowArrowElement;
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.79);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.07);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.86);
UI.resize([rectangle, arrow], "nw", [300, 350]);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(0);