From 96545c97d09e9a585c09e46c1f3ef84362d22465 Mon Sep 17 00:00:00 2001 From: Joooye_34 Date: Fri, 8 Sep 2023 01:12:07 +0800 Subject: [PATCH] feat(core): use double click to activate title renaming (#4214) --- .../blocksuite/block-suite-header-title/index.tsx | 2 +- tests/affine-local/e2e/change-page-mode.spec.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/core/src/components/blocksuite/block-suite-header-title/index.tsx b/apps/core/src/components/blocksuite/block-suite-header-title/index.tsx index 0f0006c218..68d02cb88b 100644 --- a/apps/core/src/components/blocksuite/block-suite-header-title/index.tsx +++ b/apps/core/src/components/blocksuite/block-suite-header-title/index.tsx @@ -76,7 +76,7 @@ const StableTitle = ({ {title || 'Untitled'} diff --git a/tests/affine-local/e2e/change-page-mode.spec.ts b/tests/affine-local/e2e/change-page-mode.spec.ts index bca29585b6..23e706de6b 100644 --- a/tests/affine-local/e2e/change-page-mode.spec.ts +++ b/tests/affine-local/e2e/change-page-mode.spec.ts @@ -67,7 +67,7 @@ test('Able to insert the title of an untitled page', async ({ page }) => { await openHomePage(page); await waitForEditorLoad(page); const titleBarTextContent = await page.getByTestId('title-edit-button'); - await titleBarTextContent.click({ delay: 100 }); + await titleBarTextContent.dblclick({ delay: 100 }); const titleContent = await page.getByTestId('title-content'); await titleContent.fill('test'); await titleContent.blur(); @@ -78,12 +78,12 @@ test('Able to edit the title of an existing page', async ({ page }) => { await openHomePage(page); await waitForEditorLoad(page); const titleBarTextContent = await page.getByTestId('title-edit-button'); - await titleBarTextContent.click({ delay: 100 }); + await titleBarTextContent.dblclick({ delay: 100 }); const titleContent = await page.getByTestId('title-content'); await titleContent.fill('test'); await titleContent.blur(); expect(await titleBarTextContent.textContent()).toBe('test'); - await titleBarTextContent.click({ delay: 100 }); + await titleBarTextContent.dblclick({ delay: 100 }); await titleContent.fill('Sample text 2'); await titleContent.blur(); expect(await titleBarTextContent.textContent()).toBe('Sample text 2'); @@ -95,12 +95,12 @@ test('Clearing out the title bar will remove the page title', async ({ await openHomePage(page); await waitForEditorLoad(page); const titleBarTextContent = await page.getByTestId('title-edit-button'); - await titleBarTextContent.click({ delay: 100 }); + await titleBarTextContent.dblclick({ delay: 100 }); const titleContent = await page.getByTestId('title-content'); await titleContent.fill('test'); await titleContent.blur(); expect(await titleBarTextContent.textContent()).toBe('test'); - await titleBarTextContent.click({ delay: 100 }); + await titleBarTextContent.dblclick({ delay: 100 }); await titleContent.fill(''); await titleContent.blur(); expect(await titleBarTextContent.textContent()).toBe('Untitled');