diff --git a/packages/element/tests/collision.test.tsx b/packages/element/tests/collision.test.tsx
index 4061a16cb6..2ca65e7cae 100644
--- a/packages/element/tests/collision.test.tsx
+++ b/packages/element/tests/collision.test.tsx
@@ -1,8 +1,7 @@
-import { arrayToMap } from "@excalidraw/common";
+import { arrayToMap, ROUNDNESS } from "@excalidraw/common";
import { type GlobalPoint, type LocalPoint, pointFrom } from "@excalidraw/math";
import { Excalidraw } from "@excalidraw/excalidraw";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
-import { UI } from "@excalidraw/excalidraw/tests/helpers/ui";
import "@excalidraw/utils/test-utils";
import { render } from "@excalidraw/excalidraw/tests/test-utils";
@@ -10,29 +9,29 @@ import * as distance from "../src/distance";
import { hitElementItself } from "../src/collision";
describe("check rotated elements can be hit:", () => {
- beforeEach(async () => {
- localStorage.clear();
- await render();
- });
-
it("arrow", () => {
- UI.createElement("arrow", {
+ const element = API.createElement({
+ type: "arrow",
x: 0,
y: 0,
width: 124,
height: 302,
angle: 1.8700426423973724,
+ roundness: { type: ROUNDNESS.PROPORTIONAL_RADIUS },
+ endArrowhead: "arrow",
points: [
[0, 0],
[120, -198],
[-4, -302],
] as LocalPoint[],
});
+ const elementsMap = arrayToMap([element]);
+
const hit = hitElementItself({
point: pointFrom(88, -68),
- element: window.h.elements[0],
+ element,
threshold: 10,
- elementsMap: window.h.scene.getNonDeletedElementsMap(),
+ elementsMap,
});
expect(hit).toBe(true);
});