feat(core): optimize the shift multi-selection function of doc list (#6675)

close TOV-701

https://github.com/toeverything/AFFiNE/assets/102217452/8813e603-1cc2-469f-a7c1-b18e49a14871
This commit is contained in:
JimmFly
2024-04-24 07:56:13 +00:00
parent 6525c99631
commit 350fec5397
7 changed files with 153 additions and 12 deletions
+36
View File
@@ -309,3 +309,39 @@ test('select display properties to hide bodyNotes', async ({ page }) => {
await page.locator('[data-testid="property-bodyNotes"]').click();
await expect(cell).toBeVisible();
});
test('select three pages with shiftKey and delete', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await clickNewPageButton(page);
await clickNewPageButton(page);
await clickNewPageButton(page);
await clickSideBarAllPageButton(page);
await waitForAllPagesLoad(page);
const pageCount = await getPagesCount(page);
await page.keyboard.down('Shift');
await page.locator('[data-testid="page-list-item"]').nth(0).click();
await page.locator('[data-testid="page-list-item"]').nth(2).click();
await page.keyboard.up('Shift');
// the floating popover should appear
await expect(page.locator('[data-testid="floating-toolbar"]')).toBeVisible();
await expect(page.locator('[data-testid="floating-toolbar"]')).toHaveText(
'3 doc(s) selected'
);
// click delete button
await page.locator('[data-testid="list-toolbar-delete"]').click();
// the confirm dialog should appear
await expect(page.getByText('Delete 3 docs?')).toBeVisible();
await page.getByRole('button', { name: 'Delete' }).click();
// check the page count again
await page.waitForTimeout(300);
expect(await getPagesCount(page)).toBe(pageCount - 3);
});