fix(web): hide mobile backdrop on desktop
This commit is contained in:
@@ -240,6 +240,26 @@ if (await projectNavButton.count() === 0) {
|
||||
if (!await page.locator('aside.project-rail.open').isVisible()) {
|
||||
failures.push('打开项目导航 must reveal the project rail aside')
|
||||
}
|
||||
await page.setViewportSize({ width: 1440, height: 1024 })
|
||||
const resizedDesktopMetrics = await collectMetrics()
|
||||
const desktopBackdropDisplay = await page.locator('.nav-backdrop').evaluate((node) => getComputedStyle(node).display)
|
||||
if (desktopBackdropDisplay !== 'none') {
|
||||
failures.push(`navigation backdrop must be hidden after resizing to desktop, got display=${desktopBackdropDisplay}`)
|
||||
}
|
||||
if (resizedDesktopMetrics.overflowX) {
|
||||
failures.push('resized desktop project viewport must not overflow horizontally')
|
||||
}
|
||||
if (!resizedDesktopMetrics.projectRail || !resizedDesktopMetrics.channelSidebar || !resizedDesktopMetrics.stage) {
|
||||
failures.push('resized desktop must preserve project rail, channel sidebar, and stage')
|
||||
} else if (
|
||||
Math.abs(resizedDesktopMetrics.channelSidebar.left - resizedDesktopMetrics.projectRail.right) > 1 ||
|
||||
Math.abs(resizedDesktopMetrics.stage.left - resizedDesktopMetrics.channelSidebar.right) > 1 ||
|
||||
Math.abs(resizedDesktopMetrics.stage.right - resizedDesktopMetrics.viewportWidth) > 1
|
||||
) {
|
||||
failures.push(`resized desktop layout must preserve the core grid, got rail=${JSON.stringify(resizedDesktopMetrics.projectRail)}, sidebar=${JSON.stringify(resizedDesktopMetrics.channelSidebar)}, stage=${JSON.stringify(resizedDesktopMetrics.stage)}`)
|
||||
}
|
||||
await page.setViewportSize({ width: 390, height: 844 })
|
||||
await waitForDrawerOpen('aside.project-rail')
|
||||
await page.getByRole('button', { name: '关闭导航', exact: true }).click({ position: { x: 380, y: 20 } })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user