From 0cbf244bd8be45e1df691463fc4f620237a550d4 Mon Sep 17 00:00:00 2001 From: Ryan Di Date: Thu, 21 Dec 2023 17:33:29 +0800 Subject: [PATCH] update flip tests --- packages/excalidraw/element/resizeElements.ts | 3 --- packages/excalidraw/tests/flip.test.tsx | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/excalidraw/element/resizeElements.ts b/packages/excalidraw/element/resizeElements.ts index 883382933..034f0534c 100644 --- a/packages/excalidraw/element/resizeElements.ts +++ b/packages/excalidraw/element/resizeElements.ts @@ -691,9 +691,6 @@ export const resizeMultipleElements = ( targetElements.map(({ orig }) => orig).concat(boundTextElements), ); - // const originalHeight = maxY - minY; - // const originalWidth = maxX - minX; - const direction = transformHandleType; const mapDirectionsToAnchors: Record = { diff --git a/packages/excalidraw/tests/flip.test.tsx b/packages/excalidraw/tests/flip.test.tsx index 68dce2c4a..1e7549036 100644 --- a/packages/excalidraw/tests/flip.test.tsx +++ b/packages/excalidraw/tests/flip.test.tsx @@ -18,7 +18,7 @@ import { FileId, } from "../element/types"; import { newLinearElement } from "../element"; -import { Excalidraw } from "../index"; +import { Excalidraw, isLinearElement } from "../index"; import { mutateElement } from "../element/mutateElement"; import { NormalizedZoomValue } from "../types"; import { ROUNDNESS } from "../constants"; @@ -198,11 +198,10 @@ const checkElementsBoundingBox = async ( const [x12, y12, x22, y22] = getElementAbsoluteCoords(element2); - debugger; await waitFor(() => { // Check if width and height did not change - expect(x2 - x1).toBeCloseTo(x22 - x12, -1); - expect(y2 - y1).toBeCloseTo(y22 - y12, -1); + expect(Math.abs(x2 - x1 - (x22 - x12))).toBeLessThanOrEqual(toleranceInPx); + expect(Math.abs(y2 - y1 - (y22 - y12))).toBeLessThanOrEqual(toleranceInPx); }); };