feat(core): auto select block when jump to block (#4858)

Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
JimmFly
2023-11-10 11:02:56 +08:00
committed by GitHub
parent f1e32aab66
commit 1fe5a0fffa
10 changed files with 199 additions and 185 deletions

View File

@@ -372,7 +372,7 @@ test('show not found item', async ({ page }) => {
await expect(notFoundItem).toHaveText('Search for "test123456"');
});
test('can use cmdk to search page content and scroll to it', async ({
test('can use cmdk to search page content and scroll to it, then the block will be selected', async ({
page,
}) => {
await openHomePage(page);
@@ -382,8 +382,8 @@ test('can use cmdk to search page content and scroll to it', async ({
await getBlockSuiteEditorTitle(page).fill(
'this is a new page to search for content'
);
for (let i = 0; i < 50; i++) {
await page.keyboard.press('Enter');
for (let i = 0; i < 30; i++) {
await page.keyboard.press('Enter', { delay: 10 });
}
await page.keyboard.insertText('123456');
await clickSideBarAllPageButton(page);
@@ -398,4 +398,6 @@ test('can use cmdk to search page content and scroll to it', async ({
await waitForScrollToFinish(page);
const isVisitable = await checkElementIsInView(page, '123456');
expect(isVisitable).toBe(true);
const selectionElement = page.locator('affine-block-selection');
await expect(selectionElement).toBeVisible();
});