fix: group sidebar navigation separately from personal projects

This commit is contained in:
鲨鱼辣椒
2026-09-29 23:43:21 +08:00
parent 41901ee07a
commit 774f1b7c87
5 changed files with 33 additions and 7 deletions

View File

@@ -91,11 +91,21 @@ test.describe('Makelore module navigation without setup flow', () => {
expect(returnBox).not.toBeNull();
expect(collapseBox).not.toBeNull();
expect(returnBox!.y).toBeGreaterThanOrEqual(brandBox!.y + brandBox!.height);
expect(brandBox!.y - sidebarBox!.y).toBeLessThanOrEqual(8);
expect(brandBox!.y - sidebarBox!.y).toBeLessThanOrEqual(1);
expect(Math.abs(returnBox!.y + returnBox!.height / 2 - collapseBox!.y - collapseBox!.height / 2)).toBeLessThan(1);
expect(returnBox!.x + returnBox!.width).toBeLessThanOrEqual(collapseBox!.x);
expect(sidebarBox!.x + sidebarBox!.width - collapseBox!.x - collapseBox!.width).toBeLessThanOrEqual(14);
await expect(page.getByTestId('titlebar-sidebar-toggle')).toHaveCount(1);
const community = sidebar.getByRole('button', { name: '作品广场', exact: true });
await expect(community).toHaveCount(1);
const communityBox = await community.boundingBox();
const createBox = await sidebar.getByTestId('sidebar-create-project').boundingBox();
const headingBox = await sidebar.locator('.classroom-projects-heading').boundingBox();
expect(communityBox!.y).toBeGreaterThanOrEqual(returnBox!.y + returnBox!.height);
expect(communityBox!.y - returnBox!.y - returnBox!.height).toBeLessThanOrEqual(8);
expect(createBox!.y - communityBox!.y - communityBox!.height).toBeGreaterThanOrEqual(16);
expect(headingBox!.y).toBeGreaterThanOrEqual(createBox!.y + createBox!.height);
expect(headingBox!.y - createBox!.y - createBox!.height).toBeLessThanOrEqual(14);
await page.screenshot({ path: test.info().outputPath('chat-code-return-entry.png') });
const sidebarResizer = sidebar.getByRole('separator', { name: '调整左侧功能栏宽度' });
@@ -106,6 +116,8 @@ test.describe('Makelore module navigation without setup flow', () => {
expect(narrowReturn!.x + narrowReturn!.width).toBeLessThanOrEqual(narrowToggle!.x);
await expect(moduleReturn).toBeVisible();
await expect(sidebar.getByRole('button', { name: '折叠侧栏' })).toBeVisible();
await expect(community).toBeVisible();
expect(await community.evaluate(element => element.scrollWidth <= element.clientWidth)).toBe(true);
await page.screenshot({ path: test.info().outputPath('chat-narrow-navigation-row.png') });
await sidebarResizer.dblclick();
await expect(sidebarResizer).toHaveAttribute('aria-valuenow', '171');