瀏覽代碼

update flip tests

Ryan Di 1 年之前
父節點
當前提交
0cbf244bd8
共有 2 個文件被更改,包括 3 次插入7 次删除
  1. 0 3
      packages/excalidraw/element/resizeElements.ts
  2. 3 4
      packages/excalidraw/tests/flip.test.tsx

+ 0 - 3
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<typeof direction, Point> = {

+ 3 - 4
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);
   });
 };