diff --git a/apps/app/e2e/shell/editor-deselect.spec.ts b/apps/app/e2e/shell/editor-deselect.spec.ts index 55add1cd..05a6fed3 100644 --- a/apps/app/e2e/shell/editor-deselect.spec.ts +++ b/apps/app/e2e/shell/editor-deselect.spec.ts @@ -678,4 +678,42 @@ test.describe('deselect and D6b (read-only twin at 375 px)', () => { await report('twin two-finger tap') expect(saves).toEqual([]) }) + + test('Escape closes « Plus » first, then deselects the twin', async ({ + page, + context, + requests, + }) => { + const { actor, saves } = await open(page, false) + requests.forbid(actor.account.email, actor.account.password) + await selectTab(page, dict, 'annotations') + const canvas = page.getByTestId('catalogue-canvas') + await expect(canvas).toBeVisible() + const cdp = await context.newCDPSession(page) + await canvas.scrollIntoViewIfNeeded() + const marker = await page + .getByTestId('catalogue-canvas-drawing') + .locator('[data-anno-id="pt-a"]') + .first() + .boundingBox() + await tap(cdp, { + x: marker!.x + marker!.width / 2, + y: marker!.y + marker!.height / 2, + }) + await expect(selectionTag(page)).toContainText(POINT) + + const more = page.locator('#editor-tabs-more-button') + await more.click() + await expect(more).toHaveAttribute('aria-expanded', 'true') + await canvas.focus() + await page.keyboard.press('Escape') + await expect(more).toHaveAttribute('aria-expanded', 'false') + await expect(more).toBeFocused() + await expectKept(page, POINT) + + await page.keyboard.press('Escape') + await expectDeselected(page) + await expect(liveRegion(page)).toHaveCount(1) + expect(saves).toEqual([]) + }) })