Skip to content

Build your personal knowledge base with Trilium Notes

fix(mind-map): keep the arrow tests' dispatches out of what act() returns

Elian Doranc14b5e6fd383
diff --git a/apps/client/src/widgets/type_widgets/mind_map/MapContextMenu.spec.tsx b/apps/client/src/widgets/type_widgets/mind_map/MapContextMenu.spec.tsx
index 95bb24c4f6..053c493703 100644
--- a/apps/client/src/widgets/type_widgets/mind_map/MapContextMenu.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/mind_map/MapContextMenu.spec.tsx
@@ -101,7 +101,7 @@ describe("MapContextMenu", () => {
choose("drawArrowBidirectional");
expect(hint(container)).not.toBeNull();
- act(() => to.dispatchEvent(new MouseEvent("click", { bubbles: true })));
+ act(() => { to.dispatchEvent(new MouseEvent("click", { bubbles: true })); });
expect(mind.createArrow).toHaveBeenCalledWith(from, to, { bidirectional: true });
expect(hint(container)).toBeNull();
@@ -115,7 +115,7 @@ describe("MapContextMenu", () => {
rightClick();
choose("drawArrow");
- act(() => to.dispatchEvent(new MouseEvent("click", { bubbles: true })));
+ act(() => { to.dispatchEvent(new MouseEvent("click", { bubbles: true })); });
expect(mind.createArrow).toHaveBeenCalledWith(mind.currentNode, to, undefined);
});
@@ -126,7 +126,7 @@ describe("MapContextMenu", () => {
rightClick();
choose("drawArrow");
- act(() => map.dispatchEvent(new MouseEvent("click", { bubbles: true })));
+ act(() => { map.dispatchEvent(new MouseEvent("click", { bubbles: true })); });
expect(mind.createArrow).not.toHaveBeenCalled();
expect(hint(container)).toBeNull();
@@ -147,7 +147,7 @@ describe("MapContextMenu", () => {
rightClick();
choose("drawArrow");
- act(() => from?.dispatchEvent(new MouseEvent("click", { bubbles: true })));
+ act(() => { from?.dispatchEvent(new MouseEvent("click", { bubbles: true })); });
expect(mind.createArrow).not.toHaveBeenCalled();
// Given up all the same: the click was spent, and a hint left standing would be a lie.