Show icon-only Code return above sidebar branding

This commit is contained in:
鲨鱼辣椒
2026-09-30 00:02:58 +08:00
parent a57d073877
commit 19d55e8e05
5 changed files with 30 additions and 17 deletions

View File

@@ -80,8 +80,9 @@ test.describe('Makelore module navigation without setup flow', () => {
const sidebar = page.getByTestId('sidebar');
const moduleReturn = sidebar.getByTestId('sidebar-module-switcher-trigger');
await expect(moduleReturn).toBeVisible();
await expect(moduleReturn).toContainText('编程 Code');
await expect(moduleReturn).toHaveText('');
await expect(moduleReturn).toHaveAttribute('aria-label', '返回首页');
await expect(moduleReturn).toHaveAttribute('title', '返回首页');
await expect(sidebar.getByTestId('sidebar-module-return-icon')).toBeVisible();
const brandBox = await sidebar.locator('.classroom-brand').boundingBox();
const returnBox = await moduleReturn.boundingBox();
@@ -90,8 +91,9 @@ test.describe('Makelore module navigation without setup flow', () => {
expect(brandBox).not.toBeNull();
expect(returnBox).not.toBeNull();
expect(collapseBox).not.toBeNull();
expect(returnBox!.y).toBeGreaterThanOrEqual(brandBox!.y + brandBox!.height);
expect(brandBox!.y - sidebarBox!.y).toBeLessThanOrEqual(1);
expect(returnBox!.y + returnBox!.height).toBeLessThanOrEqual(brandBox!.y);
expect(returnBox!.y - sidebarBox!.y).toBeLessThanOrEqual(4);
expect(returnBox!.width).toBe(32);
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);
@@ -101,8 +103,8 @@ test.describe('Makelore module navigation without setup flow', () => {
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(communityBox!.y).toBeGreaterThanOrEqual(brandBox!.y + brandBox!.height);
expect(communityBox!.y - brandBox!.y - brandBox!.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);