refactor(core): rename explorer to navigation-panel (#11876)

This commit is contained in:
EYHN
2025-04-22 12:47:35 +08:00
committed by GitHub
parent f918573ba8
commit e4d6833296
104 changed files with 913 additions and 769 deletions

View File

@@ -67,26 +67,34 @@ const createAndPinCollection = async (
test('Show collections items in sidebar', async ({ page }) => {
await removeOnboardingPages(page);
await createAndPinCollection(page);
const collections = page.getByTestId('explorer-collections');
const collections = page.getByTestId('navigation-panel-collections');
await collections.getByTestId('category-divider-collapse-button').click();
const items = collections.locator('[data-testid^="explorer-collection-"]');
const items = collections.locator(
'[data-testid^="navigation-panel-collection-"]'
);
await expect(items).toHaveCount(1);
const first = items.first();
expect(await first.textContent()).toBe('test collection');
await first.getByTestId('explorer-collapsed-button').click();
const collectionPage = first.locator('[data-testid^="explorer-doc-"]').nth(0);
await first.getByTestId('navigation-panel-collapsed-button').click();
const collectionPage = first
.locator('[data-testid^="navigation-panel-doc-"]')
.nth(0);
expect(await collectionPage.textContent()).toBe('test page');
await collectionPage.hover();
await collectionPage
.getByTestId('explorer-tree-node-operation-button')
.getByTestId('navigation-panel-tree-node-operation-button')
.click();
const deletePage = page.getByText('Move to trash');
await deletePage.click();
await page.getByTestId('confirm-modal-confirm').click();
expect(await first.locator('[data-testid^="explorer-doc-"]').count()).toBe(0);
expect(
await first.locator('[data-testid^="navigation-panel-doc-"]').count()
).toBe(0);
// position is a workaround for the hover issue when empty collection status's height > 26px (will cause scroll)
await first.hover({ position: { x: 10, y: 10 } });
await first.getByTestId('explorer-tree-node-operation-button').click();
await first
.getByTestId('navigation-panel-tree-node-operation-button')
.click();
const deleteCollection = page.getByText('Delete');
await deleteCollection.click();
await page.waitForTimeout(50);
@@ -109,13 +117,17 @@ test('Show collections items in sidebar', async ({ page }) => {
test('edit collection', async ({ page }) => {
await removeOnboardingPages(page);
await createAndPinCollection(page);
const collections = page.getByTestId('explorer-collections');
const collections = page.getByTestId('navigation-panel-collections');
await collections.getByTestId('category-divider-collapse-button').click();
const items = collections.locator('[data-testid^="explorer-collection-"]');
const items = collections.locator(
'[data-testid^="navigation-panel-collection-"]'
);
expect(await items.count()).toBe(1);
const first = items.first();
await first.hover();
await first.getByTestId('explorer-tree-node-operation-button').click();
await first
.getByTestId('navigation-panel-tree-node-operation-button')
.click();
const editCollection = page.getByText('Rename');
await editCollection.click();
await page.getByTestId('rename-modal-input').fill('123');
@@ -127,13 +139,17 @@ test('edit collection', async ({ page }) => {
test('edit collection and change filter date', async ({ page }) => {
await removeOnboardingPages(page);
await createAndPinCollection(page);
const collections = page.getByTestId('explorer-collections');
const collections = page.getByTestId('navigation-panel-collections');
await collections.getByTestId('category-divider-collapse-button').click();
const items = collections.locator('[data-testid^="explorer-collection-"]');
const items = collections.locator(
'[data-testid^="navigation-panel-collection-"]'
);
expect(await items.count()).toBe(1);
const first = items.first();
await first.hover();
await first.getByTestId('explorer-tree-node-operation-button').click();
await first
.getByTestId('navigation-panel-tree-node-operation-button')
.click();
const editCollection = page.getByText('Rename');
await editCollection.click();
await page.getByTestId('rename-modal-input').fill('123');
@@ -151,21 +167,23 @@ test('add collection from sidebar', async ({ page }) => {
const cell = page.getByTestId('page-list-item-title').getByText('test page');
await expect(cell).toBeVisible();
await page
.getByTestId('explorer-collections')
.getByTestId('navigation-panel-collections')
.getByTestId('category-divider-collapse-button')
.click();
const nullCollection = page.getByTestId(
'slider-bar-collection-empty-message'
);
await expect(nullCollection).toBeVisible();
await page.getByTestId('explorer-bar-add-collection-button').click();
await page.getByTestId('navigation-panel-bar-add-collection-button').click();
const title = page.getByTestId('prompt-modal-input');
await expect(title).toBeVisible();
await title.fill('test collection');
await page.getByTestId('prompt-modal-confirm').click();
await page.waitForTimeout(100);
const collections = page.getByTestId('explorer-collections');
const items = collections.locator('[data-testid^="explorer-collection-"]');
const collections = page.getByTestId('navigation-panel-collections');
const items = collections.locator(
'[data-testid^="navigation-panel-collection-"]'
);
expect(await items.count()).toBe(1);
await expect(nullCollection).not.toBeVisible();
});