Adapting tests to a more precise tracking

feat/remove-ga
Mark Tolmacs 3 weeks ago
parent 3e1439ad86
commit da6a39834d
No known key found for this signature in database

@ -89,8 +89,8 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"endBinding": {
"elementId": "ellipse-1",
"fixedPoint": null,
"focus": -0.008153707962747813,
"gap": 1,
"focus": -0.008835048729392623,
"gap": 11.562288374879595,
},
"fillStyle": "solid",
"frameId": null,
@ -120,7 +120,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"startBinding": {
"elementId": "id49",
"fixedPoint": null,
"focus": -0.08139534883720931,
"focus": -0.08860759493670874,
"gap": 1,
},
"strokeColor": "#1864ab",
@ -147,8 +147,8 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"endBinding": {
"elementId": "ellipse-1",
"fixedPoint": null,
"focus": 0.10666666666666667,
"gap": 3.834326468444573,
"focus": 0.1045751633986928,
"gap": 3.8343264684446097,
},
"fillStyle": "solid",
"frameId": null,
@ -179,7 +179,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing s
"elementId": "diamond-1",
"fixedPoint": null,
"focus": 0,
"gap": 1,
"gap": 4.545343408287929,
},
"strokeColor": "#e67700",
"strokeStyle": "solid",
@ -1485,7 +1485,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"endBinding": {
"elementId": "Alice",
"fixedPoint": null,
"focus": 0,
"focus": 1.7573472843231123e-16,
"gap": 5.299874999999986,
},
"fillStyle": "solid",
@ -1551,7 +1551,7 @@ exports[`Test Transform > should transform the elements correctly when linear el
"elementId": "B",
"fixedPoint": null,
"focus": 0,
"gap": 1,
"gap": 14,
},
"fillStyle": "solid",
"frameId": null,

@ -197,7 +197,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": 99,
"height": "102.03384",
"id": "id172",
"index": "a2",
"isDeleted": false,
@ -211,8 +211,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
0,
],
[
"98.20800",
99,
"101.21757",
"102.03384",
],
],
"roughness": 1,
@ -227,7 +227,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow",
"updated": 1,
"version": 40,
"width": "98.20800",
"width": "101.21757",
"x": 1,
"y": 0,
}
@ -295,24 +295,24 @@ History {
"endBinding": {
"elementId": "id171",
"fixedPoint": null,
"focus": "0.00990",
"focus": "0.01000",
"gap": 1,
},
"height": "0.98017",
"height": "1.38641",
"points": [
[
0,
0,
],
[
98,
"-0.98017",
"98.00000",
"-1.38641",
],
],
"startBinding": {
"elementId": "id170",
"fixedPoint": null,
"focus": "0.02970",
"focus": "0.03001",
"gap": 1,
},
},
@ -323,7 +323,7 @@ History {
"focus": "-0.02000",
"gap": 1,
},
"height": "0.00169",
"height": "0.00233",
"points": [
[
0,
@ -331,7 +331,7 @@ History {
],
[
98,
"0.00169",
"0.00233",
],
],
"startBinding": {
@ -393,15 +393,15 @@ History {
"focus": 0,
"gap": 1,
},
"height": 99,
"height": "102.03384",
"points": [
[
0,
0,
],
[
"98.20800",
99,
"101.21757",
"102.03384",
],
],
"startBinding": null,
@ -411,10 +411,10 @@ History {
"endBinding": {
"elementId": "id171",
"fixedPoint": null,
"focus": "0.00990",
"focus": "0.01000",
"gap": 1,
},
"height": "0.98161",
"height": "1.38842",
"points": [
[
0,
@ -422,16 +422,16 @@ History {
],
[
98,
"-0.98161",
"-1.38842",
],
],
"startBinding": {
"elementId": "id170",
"fixedPoint": null,
"focus": "0.02970",
"focus": "0.03001",
"gap": 1,
},
"y": "0.99245",
"y": "1.40379",
},
},
"id175" => Delta {
@ -824,8 +824,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow",
"updated": 1,
"version": 30,
"width": 0,
"x": 200,
"width": 100,
"x": 150,
"y": 0,
}
`;
@ -858,7 +858,7 @@ History {
0,
],
[
0,
100,
0,
],
],
@ -944,7 +944,7 @@ History {
0,
],
[
0,
100,
0,
],
],
@ -1246,7 +1246,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": "2.61991",
"height": "2.57347",
"id": "id178",
"index": "Zz",
"isDeleted": false,
@ -1260,8 +1260,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
0,
],
[
"98.00000",
"-2.61991",
98,
"-2.57347",
],
],
"roughness": 1,
@ -1284,9 +1284,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow",
"updated": 1,
"version": 11,
"width": "98.00000",
"x": "1.00000",
"y": "3.98333",
"width": 98,
"x": 1,
"y": "3.91272",
}
`;
@ -1617,7 +1617,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": "2.61991",
"height": "2.57347",
"id": "id181",
"index": "a0",
"isDeleted": false,
@ -1631,8 +1631,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
0,
],
[
"98.00000",
"-2.61991",
98,
"-2.57347",
],
],
"roughness": 1,
@ -1655,9 +1655,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow",
"updated": 1,
"version": 11,
"width": "98.00000",
"x": "1.00000",
"y": "3.98333",
"width": 98,
"x": 1,
"y": "3.91272",
}
`;
@ -1775,7 +1775,7 @@ History {
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": "22.36242",
"height": "22.11765",
"index": "a0",
"isDeleted": false,
"lastCommittedPoint": null,
@ -1788,8 +1788,8 @@ History {
0,
],
[
"98.00000",
"-22.36242",
"98.67659",
"-22.11765",
],
],
"roughness": 1,
@ -1810,9 +1810,9 @@ History {
"strokeStyle": "solid",
"strokeWidth": 2,
"type": "arrow",
"width": "98.00000",
"x": 1,
"y": 34,
"width": "98.67659",
"x": "0.32341",
"y": "33.54894",
},
"inserted": {
"isDeleted": true,
@ -2329,7 +2329,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": "408.19672",
"height": 0,
"id": "id186",
"index": "a2",
"isDeleted": false,
@ -2343,8 +2343,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
0,
],
[
498,
"-408.19672",
99,
0,
],
],
"roughness": 1,
@ -2364,7 +2364,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
"type": "arrow",
"updated": 1,
"version": 10,
"width": 498,
"width": 99,
"x": 1,
"y": 0,
}
@ -15143,7 +15143,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
0,
],
[
"98.00000",
98,
0,
],
],
@ -15164,7 +15164,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"type": "arrow",
"updated": 1,
"version": 10,
"width": "98.00000",
"width": 98,
"x": 1,
"y": 0,
}
@ -15842,7 +15842,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
0,
],
[
"98.00000",
98,
0,
],
],
@ -15863,7 +15863,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"type": "arrow",
"updated": 1,
"version": 10,
"width": "98.00000",
"width": 98,
"x": 1,
"y": 0,
}
@ -16465,7 +16465,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
0,
],
[
"98.00000",
98,
0,
],
],
@ -16486,7 +16486,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"type": "arrow",
"updated": 1,
"version": 10,
"width": "98.00000",
"width": 98,
"x": 1,
"y": 0,
}
@ -17086,7 +17086,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
0,
],
[
"98.00000",
98,
0,
],
],
@ -17107,7 +17107,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"type": "arrow",
"updated": 1,
"version": 10,
"width": "98.00000",
"width": 98,
"x": 1,
"y": 0,
}
@ -17804,7 +17804,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
0,
],
[
"98.00000",
98,
0,
],
],
@ -17825,7 +17825,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
"type": "arrow",
"updated": 1,
"version": 11,
"width": "98.00000",
"width": 98,
"x": 1,
"y": 0,
}

@ -191,13 +191,13 @@ exports[`move element > rectangles with binding arrow 7`] = `
"endBinding": {
"elementId": "id1",
"fixedPoint": null,
"focus": "-0.46667",
"focus": "-0.77778",
"gap": 10,
},
"fillStyle": "solid",
"frameId": null,
"groupIds": [],
"height": "81.47368",
"height": "106.56082",
"id": "id2",
"index": "a2",
"isDeleted": false,
@ -211,8 +211,8 @@ exports[`move element > rectangles with binding arrow 7`] = `
0,
],
[
81,
"81.47368",
"81.00000",
"106.56082",
],
],
"roughness": 1,
@ -224,7 +224,7 @@ exports[`move element > rectangles with binding arrow 7`] = `
"startBinding": {
"elementId": "id0",
"fixedPoint": null,
"focus": "-0.60000",
"focus": "-1.00000",
"gap": 10,
},
"strokeColor": "#1e1e1e",
@ -234,7 +234,7 @@ exports[`move element > rectangles with binding arrow 7`] = `
"updated": 1,
"version": 11,
"versionNonce": 1051383431,
"width": 81,
"width": "81.00000",
"x": 110,
"y": 50,
}

@ -9,7 +9,7 @@ import {
togglePopover,
getCloneByOrigId,
} from "./test-utils";
import "../utils/test-utils";
import "../../utils/test-utils";
import { Excalidraw } from "../index";
import { Keyboard, Pointer, UI } from "./helpers/ui";
import { API } from "./helpers/api";

@ -125,7 +125,7 @@ describe("move element", () => {
expect([rectB.x, rectB.y]).toEqual([201, 2]);
expect([Math.round(arrow.x), Math.round(arrow.y)]).toEqual([110, 50]);
expect([Math.round(arrow.width), Math.round(arrow.height)]).toEqual([
81, 81,
81, 107,
]);
h.elements.forEach((element) => expect(element).toMatchSnapshot());

@ -502,12 +502,12 @@ describe("arrow element", () => {
h.state,
)[0] as ExcalidrawElbowArrowElement;
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.75);
UI.resize(rectangle, "se", [-200, -150]);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.75);
});
@ -530,12 +530,12 @@ describe("arrow element", () => {
h.state,
)[0] as ExcalidrawElbowArrowElement;
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1.05);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(1);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.75);
UI.resize([rectangle, arrow], "nw", [300, 350]);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(-0.144);
expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(0);
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.25);
});
});
@ -1047,7 +1047,9 @@ describe("multiple selection", () => {
expect(rightBoundArrow.endBinding?.elementId).toBe(
rightArrowBinding.elementId,
);
expect(rightBoundArrow.endBinding?.focus).toBe(rightArrowBinding.focus);
expect(rightBoundArrow.endBinding?.focus).toBeCloseTo(
rightArrowBinding.focus!,
);
});
it("resizes with labeled arrows", async () => {

@ -70,13 +70,13 @@ test("unselected bound arrows update when rotating their target elements", async
expect(ellipseArrow.x).toEqual(0);
expect(ellipseArrow.y).toEqual(0);
expect(ellipseArrow.points[0]).toEqual([0, 0]);
expect(ellipseArrow.points[1][0]).toBeCloseTo(48.5, 1);
expect(ellipseArrow.points[1][1]).toBeCloseTo(126.5, 1);
expect(ellipseArrow.points[1][0]).toBeCloseTo(56.1, 1);
expect(ellipseArrow.points[1][1]).toBeCloseTo(116.85, 1);
expect(textArrow.endBinding?.elementId).toEqual(text.id);
expect(textArrow.x).toEqual(360);
expect(textArrow.y).toEqual(300);
expect(textArrow.points[0]).toEqual([0, 0]);
expect(textArrow.points[1][0]).toBeCloseTo(-94, 0);
expect(textArrow.points[1][1]).toBeCloseTo(-116.1, 0);
expect(textArrow.points[1][0]).toBeCloseTo(-89, 0);
expect(textArrow.points[1][1]).toBeCloseTo(-120.39, 0);
});

@ -31,7 +31,7 @@ describe("Math curve", () => {
);
const l = line(pointFrom(0, 0), pointFrom(200, 200));
expect(curveIntersectLine(c, l)).toCloselyEqualPoints([[72.5, 72.5]]);
expect(curveIntersectLine(c, l)).toCloselyEqualPoints([[73.65, 73.65]]);
});
it("points are found when curve is sliced at 3 points", () => {

Loading…
Cancel
Save