mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor(core): improve editor gap appendParagraph function (#8567)
close AF-1257 Every time we clicked on an empty space at the bottom, a new Paragraph block was created. Now we change it so that if there is already an empty Paragraph block at the bottom, we focus it instead of creating a new one.
This commit is contained in:
@@ -64,3 +64,25 @@ test('link page is useable', async ({ page }) => {
|
||||
page.locator('.doc-title-container:has-text("page1")')
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('append paragraph when click editor gap', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitForEditorLoad(page);
|
||||
await clickNewPageButton(page);
|
||||
await waitForEditorLoad(page);
|
||||
|
||||
const title = getBlockSuiteEditorTitle(page);
|
||||
await title.pressSequentially('test title');
|
||||
await page.keyboard.press('ArrowDown');
|
||||
await page.keyboard.insertText('test content');
|
||||
|
||||
const paragraph = page.locator('affine-paragraph');
|
||||
const numParagraphs = await paragraph.count();
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user