From 774b0bdb5f706d214928c1fa6e5b8af9a9e596a9 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 12 May 2026 22:13:26 +0200 Subject: [PATCH] Add tests for multi-selection and advanced selection logic (shift-click) --- tests/domain/selection.test.ts | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/domain/selection.test.ts b/tests/domain/selection.test.ts index 6a15fdba..9a5cb07a 100644 --- a/tests/domain/selection.test.ts +++ b/tests/domain/selection.test.ts @@ -86,6 +86,68 @@ describe("selection click helpers", () => { expect(getSelectionDefaultActiveId(nextSelection)).toBe("entity-main"); }); + it("multi-selects path points on the same path with shift-click", () => { + const firstSelection = applyEditorSelectionClick( + { + kind: "none" + }, + { + kind: "pathPoint", + pathId: "path-main", + pointId: "point-a" + }, + false + ); + const secondSelection = applyEditorSelectionClick( + firstSelection, + { + kind: "pathPoint", + pathId: "path-main", + pointId: "point-b" + }, + true + ); + + expect(secondSelection).toEqual({ + kind: "pathPoints", + pathId: "path-main", + pointIds: ["point-a", "point-b"] + }); + expect(getSelectionDefaultActiveId(secondSelection)).toBe("point-b"); + + const toggledSelection = applyEditorSelectionClick( + secondSelection, + { + kind: "pathPoint", + pathId: "path-main", + pointId: "point-b" + }, + true + ); + + expect(toggledSelection).toEqual({ + kind: "pathPoint", + pathId: "path-main", + pointId: "point-a" + }); + + expect( + applyEditorSelectionClick( + toggledSelection, + { + kind: "pathPoint", + pathId: "path-other", + pointId: "point-x" + }, + true + ) + ).toEqual({ + kind: "pathPoint", + pathId: "path-other", + pointId: "point-x" + }); + }); + it("clears on empty click without shift and preserves on empty shift-click", () => { const currentSelection = { kind: "modelInstances" as const,