mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-05 19:40:30 +08:00
fix: close docs bulk toolbar after delete (#14711)
### Before https://www.loom.com/share/a626b23f29cb4a48b33d721341d734f8 ### After https://www.loom.com/share/0c88ef4f92ac470fbb76608e2de43fa7 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed floating toolbar remaining visible after deleting multiple documents via the confirmation dialog so it reliably closes when deletion completes. * **Tests** * Added end-to-end checks to verify the floating toolbar is dismissed after multi-item and “select all” deletions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
This commit is contained in:
@@ -198,6 +198,7 @@ export const DocsExplorer = ({
|
|||||||
const doc = docsService.list.doc$(docId).value;
|
const doc = docsService.list.doc$(docId).value;
|
||||||
doc?.moveToTrash();
|
doc?.moveToTrash();
|
||||||
}
|
}
|
||||||
|
handleCloseFloatingToolbar();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ test('select two pages and delete', async ({ page }) => {
|
|||||||
|
|
||||||
// check the page count again
|
// check the page count again
|
||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
|
await expect(
|
||||||
|
page.locator('[data-testid="floating-toolbar"]')
|
||||||
|
).not.toBeVisible();
|
||||||
|
|
||||||
expect(await getPagesCount(page)).toBe(pageCount - 2);
|
expect(await getPagesCount(page)).toBe(pageCount - 2);
|
||||||
});
|
});
|
||||||
@@ -156,10 +159,40 @@ test('select three pages with shiftKey and delete', async ({ page }) => {
|
|||||||
|
|
||||||
// check the page count again
|
// check the page count again
|
||||||
await page.waitForTimeout(300);
|
await page.waitForTimeout(300);
|
||||||
|
await expect(
|
||||||
|
page.locator('[data-testid="floating-toolbar"]')
|
||||||
|
).not.toBeVisible();
|
||||||
|
|
||||||
expect(await getPagesCount(page)).toBe(pageCount - 3);
|
expect(await getPagesCount(page)).toBe(pageCount - 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('select all and delete closes the floating toolbar', async ({ page }) => {
|
||||||
|
await openHomePage(page);
|
||||||
|
await waitForEditorLoad(page);
|
||||||
|
await clickNewPageButton(page);
|
||||||
|
await clickNewPageButton(page);
|
||||||
|
await clickSideBarAllPageButton(page);
|
||||||
|
await waitForAllPagesLoad(page);
|
||||||
|
|
||||||
|
const pageCount = await getPagesCount(page);
|
||||||
|
|
||||||
|
const selectAllButton = page
|
||||||
|
.getByRole('button', { name: 'Select all' })
|
||||||
|
.last();
|
||||||
|
await selectAllButton.hover();
|
||||||
|
await selectAllButton.click();
|
||||||
|
|
||||||
|
await expect(page.locator('[data-testid="floating-toolbar"]')).toBeVisible();
|
||||||
|
await page.locator('[data-testid="list-toolbar-delete"]').click();
|
||||||
|
await page.getByRole('button', { name: 'Delete' }).click();
|
||||||
|
|
||||||
|
await page.waitForTimeout(300);
|
||||||
|
await expect(
|
||||||
|
page.locator('[data-testid="floating-toolbar"]')
|
||||||
|
).not.toBeVisible();
|
||||||
|
expect(await getPagesCount(page)).toBeLessThan(pageCount);
|
||||||
|
});
|
||||||
|
|
||||||
test('create a tag and delete it', async ({ page }) => {
|
test('create a tag and delete it', async ({ page }) => {
|
||||||
await openHomePage(page);
|
await openHomePage(page);
|
||||||
await waitForEditorLoad(page);
|
await waitForEditorLoad(page);
|
||||||
|
|||||||
Reference in New Issue
Block a user