mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-08 12:45:55 +08:00
fix(core): editor blur unexpectedly when clicking blank area (#10501)
### Before https://github.com/user-attachments/assets/3c4b20e1-6d89-4dc7-a51f-04b6e9a89486 ### After https://github.com/user-attachments/assets/86b93403-597e-4dbb-ab65-90908342c230
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { locateEditorContainer } from '@affine-test/kit/utils/editor';
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import {
|
||||
addDatabase,
|
||||
@@ -82,7 +83,15 @@ test('append paragraph when click editor gap', async ({ page }) => {
|
||||
await page.locator('[data-testid=page-editor-blank]').click();
|
||||
expect(await paragraph.count()).toBe(numParagraphs + 1);
|
||||
|
||||
// click the gap again, should not append another paragraph
|
||||
await page.locator('[data-testid=page-editor-blank]').click();
|
||||
expect(await paragraph.count()).toBe(numParagraphs + 1);
|
||||
expect(
|
||||
await paragraph.count(),
|
||||
'click the gap again, should not append another paragraph'
|
||||
).toBe(numParagraphs + 1);
|
||||
|
||||
const editorContainer = locateEditorContainer(page);
|
||||
expect(
|
||||
await editorContainer.evaluate(el => el.contains(document.activeElement)),
|
||||
'editor should should keep being focused'
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user