From f3c4f7baa9e12a0437597e3e1b56b9f81315b4dc Mon Sep 17 00:00:00 2001 From: bchanot Date: Thu, 19 Nov 2026 15:03:07 +0100 Subject: [PATCH] test(tests): a resumed shape has no interior drag and no handle past 40 --- .../unit/editor-creation-dialog.test.tsx | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/apps/app/tests/unit/editor-creation-dialog.test.tsx b/apps/app/tests/unit/editor-creation-dialog.test.tsx index b37b13c9..90740413 100644 --- a/apps/app/tests/unit/editor-creation-dialog.test.tsx +++ b/apps/app/tests/unit/editor-creation-dialog.test.tsx @@ -471,6 +471,40 @@ describe('« Reprendre le tracé » edits the closed shape with its handles (boa ).toBeInTheDocument() }) + it('an interior press-and-drag of the pending zone moves nothing (no interior drag)', async () => { + await resumed() + const before = untouched() + const box = canvas() + fireEvent.pointerDown(box, { ...mouse, clientX: 50, clientY: 50 }) + fireEvent.pointerMove(box, { ...mouse, clientX: 60, clientY: 60 }) + fireEvent.pointerMove(box, { ...mouse, clientX: 70, clientY: 70 }) + fireEvent.pointerUp(box, { ...mouse, buttons: 0, clientX: 70, clientY: 70 }) + expect(shape()).toEqual(SQUARE) + expect(untouched()).toEqual(before) + expect(creation()).toMatchObject({ closed: true, dialog: false }) + }) + + it('a resumed shape above 40 vertices shows no handles (the stored-zone cap)', async () => { + // A comb of 38 teeth between two lower corners, started far from the teeth (a press near + // the first vertex closes the tracing): 41 vertices. + const many: Point[] = [ + [50, 95], + [10, 80], + ...Array.from( + { length: 38 }, + (_, i): Point => [12 + 2 * i, 20 + (i % 2) * 5], + ), + [90, 80], + ] + await resumed('Tibia', many) + expect(shape()).toHaveLength(41) + expect(screen.queryByRole('group', { name: 'Sommets de Tibia' })).toBeNull() + expect( + screen.queryByRole('button', { name: /^Sommet \d+ de Tibia$/ }), + ).toBeNull() + expect(ghost()).toBeInTheDocument() + }) + it('a keyboard link resumes with handles, « ce nouvel accès » while unnamed', async () => { const user = await mount(withDetail()) await user.click(screen.getByRole('button', { name: 'Ajouter un accès' }))