From 2e6d0ecb65564cef14c72c1e1caa07b1062392ac Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Fri, 9 May 2025 22:02:56 +0200 Subject: [PATCH] Fix tests Signed-off-by: Mark Tolmacs --- packages/element/tests/align.test.tsx | 12 ++++++++++-- .../tests/__snapshots__/history.test.tsx.snap | 12 +++++++----- packages/excalidraw/wysiwyg/textWysiwyg.test.tsx | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/element/tests/align.test.tsx b/packages/element/tests/align.test.tsx index 2dcafc65b..afffb72cb 100644 --- a/packages/element/tests/align.test.tsx +++ b/packages/element/tests/align.test.tsx @@ -35,6 +35,7 @@ const createAndSelectTwoRectangles = () => { // The second rectangle is already reselected because it was the last element created mouse.reset(); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); }; @@ -52,6 +53,7 @@ const createAndSelectTwoRectanglesWithDifferentSizes = () => { // The second rectangle is already reselected because it was the last element created mouse.reset(); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); }; @@ -202,6 +204,7 @@ describe("aligning", () => { // The second rectangle is already reselected because it was the last element created mouse.reset(); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); @@ -215,6 +218,7 @@ describe("aligning", () => { // Add the created group to the current selection mouse.restorePosition(0, 0); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); }; @@ -316,6 +320,7 @@ describe("aligning", () => { // The second rectangle is already selected because it was the last element created mouse.reset(); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); @@ -330,7 +335,7 @@ describe("aligning", () => { mouse.down(); mouse.up(100, 100); - mouse.restorePosition(200, 200); + mouse.restorePosition(210, 200); Keyboard.withModifierKeys({ shift: true }, () => { mouse.click(); }); @@ -341,6 +346,7 @@ describe("aligning", () => { // The second group is already selected because it was the last group created mouse.reset(); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); }; @@ -454,6 +460,7 @@ describe("aligning", () => { // The second rectangle is already reselected because it was the last element created mouse.reset(); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); @@ -466,7 +473,7 @@ describe("aligning", () => { mouse.up(100, 100); // Add group to current selection - mouse.restorePosition(0, 0); + mouse.restorePosition(10, 0); Keyboard.withModifierKeys({ shift: true }, () => { mouse.click(); }); @@ -482,6 +489,7 @@ describe("aligning", () => { // Select the nested group, the rectangle is already selected mouse.reset(); Keyboard.withModifierKeys({ shift: true }, () => { + mouse.moveTo(10, 0); mouse.click(); }); }; diff --git a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap index 5e3f00c31..6d9d7f090 100644 --- a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap @@ -779,7 +779,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": 0, + "height": "0.00000", "id": "id668", "index": "a2", "isDeleted": false, @@ -855,14 +855,14 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 100, - 0, + "-0.00000", ], ], }, "inserted": { "endBinding": { "elementId": "id665", - "focus": -0, + "focus": "0.00000", "gap": 1, }, "points": [ @@ -918,6 +918,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], ], "startBinding": null, + "y": 0, }, "inserted": { "points": [ @@ -927,14 +928,15 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 100, - 0, + "-0.00000", ], ], "startBinding": { "elementId": "id664", - "focus": 0, + "focus": "-0.00000", "gap": 1, }, + "y": "0.00000", }, }, }, diff --git a/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx b/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx index e7cd97509..86fa94837 100644 --- a/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx +++ b/packages/excalidraw/wysiwyg/textWysiwyg.test.tsx @@ -790,7 +790,7 @@ describe("textWysiwyg", () => { freedraw.x + freedraw.width / 2, freedraw.y + freedraw.height / 2, ); - + console.log(JSON.stringify(h.elements)); const editor = await getTextEditor(textEditorSelector, true); updateTextEditor(editor, "Hello World!"); Keyboard.exitTextEditor(editor);