From 1c9af85e6805afa83479c11fb81675c7c1ffa448 Mon Sep 17 00:00:00 2001 From: Mahsa Kohan Date: Mon, 16 Nov 2026 16:25:41 +0100 Subject: [PATCH 1/3] feat: add confirmation before deleting notes Assisted-by: ChatGPT:GPT-6 Signed-off-by: Mahsa Kohan --- playwright/e2e/note-actions.spec.ts | 24 ++++++++++++++++++ src/components/NoteItem.vue | 38 ++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/playwright/e2e/note-actions.spec.ts b/playwright/e2e/note-actions.spec.ts index 8c3d5ffee..1da1f14ab 100644 --- a/playwright/e2e/note-actions.spec.ts +++ b/playwright/e2e/note-actions.spec.ts @@ -54,6 +54,22 @@ test.describe('Note actions', () => { await expect(noteRow(page, noteId)).toContainText(renamedTitle) }) + test('keeps a note when deletion is canceled', async ({ page }, testInfo: TestInfo) => { + const title = uniqueTitle('cancel-delete', testInfo) + const noteId = await createNote(page, title) + + await openNoteActions(page, noteId) + await page.getByRole('menuitem', { name: 'Delete note' }).click() + + const confirmationDialog = page.getByRole('dialog', { name: 'Delete note' }) + await expect(confirmationDialog).toBeVisible() + + await confirmationDialog.getByRole('button', { name: 'Cancel' }).click() + + await expect(confirmationDialog).not.toBeVisible() + await expect(noteRow(page, noteId)).toBeVisible() + }) + test('deletes a note and undoes the deletion', async ({ page }, testInfo: TestInfo) => { const title = uniqueTitle('delete', testInfo) const autotitleSettled = page.waitForResponse((response) => response.url().includes('/autotitle')).catch(() => null) @@ -63,6 +79,14 @@ test.describe('Note actions', () => { await openNoteActions(page, noteId) await page.getByRole('menuitem', { name: 'Delete note' }).click() + const confirmationDialog = page.getByRole('dialog', { name: 'Delete note' }) + await expect(confirmationDialog).toBeVisible() + await expect(confirmationDialog).toContainText(title) + + await expect(noteRow(page, noteId)).toHaveCount(1) + + await confirmationDialog.getByRole('button', { name: 'Delete', exact: true }).click() + await expect(noteRow(page, noteId)).toHaveCount(0) const undoButton = page.getByRole('button', { name: 'Undo Delete', exact: true }) diff --git a/src/components/NoteItem.vue b/src/components/NoteItem.vue index e71221f96..e433916db 100644 --- a/src/components/NoteItem.vue +++ b/src/components/NoteItem.vue @@ -102,10 +102,14 @@ + {{ t('notes', 'Delete note') }} @@ -113,15 +117,17 @@