From bb537d2c19a26d3410db0a28d1a699e3bfb0d8a4 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 7 Nov 2026 17:05:04 +0100 Subject: [PATCH] test(e2e): keep the editor draft when Escape dismisses the slash menu --- .../editor/suggestion-popup-position.spec.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/frontend/tests/e2e/editor/suggestion-popup-position.spec.ts b/frontend/tests/e2e/editor/suggestion-popup-position.spec.ts index a28a28e29..06fa78d0e 100644 --- a/frontend/tests/e2e/editor/suggestion-popup-position.spec.ts +++ b/frontend/tests/e2e/editor/suggestion-popup-position.spec.ts @@ -108,4 +108,28 @@ test.describe('Suggestion popup positioning', () => { expect(Math.abs(box.x - anchor.x)).toBeLessThan(20) } }) + + test('Escape closes the popup without discarding the unsaved edit', async ({authenticatedPage: page}) => { + const tasks = await TaskFactory.create(1, { + id: 1, + project_id: projectId, + description: 'x', + index: 1, + }) + + await page.goto(`/tasks/${tasks[0].id}`) + await page.waitForLoadState('networkidle') + + const editor = await openDescriptionEditor(page) + await editor.click() + await page.keyboard.press('End') + await editor.pressSequentially(' draft /', {delay: 60}) + + const popup = page.locator('.items').first() + await expect(popup).toBeVisible() + + await page.keyboard.press('Escape') + await expect(popup).toBeHidden() + await expect(editor).toHaveText('x draft /') + }) })