fix: widen Today on desktop
ci / gitleaks (push) Successful in 8s
ci / docker (push) Successful in 3m41s

This commit is contained in:
2026-09-18 09:18:15 +08:00
parent 4d5d1f46e0
commit 28698a47b7
3 changed files with 10 additions and 8 deletions
+7 -7
View File
@@ -1,7 +1,7 @@
import type { APIRequestContext } from '@playwright/test' import type { APIRequestContext } from '@playwright/test'
import { expect, test } from './fixtures' import { expect, test } from './fixtures'
const widths = [721, 720, 390, 375] const widths = [1440, 721, 720, 390, 375]
async function csrf(request: APIRequestContext) { async function csrf(request: APIRequestContext) {
const state = await request.storageState() const state = await request.storageState()
@@ -50,8 +50,8 @@ test('Today plain-list layout matches the approved responsive geometry', async (
} }
})).toEqual({ })).toEqual({
media720: width <= 720, media720: width <= 720,
contentWidth: width === 721 ? 630 : width - 58, contentWidth: width >= 1440 ? 900 : width === 721 ? 630 : width - 58,
environmentHeight: width === 721 ? 55 : width === 375 ? 90 : 93, environmentHeight: width >= 721 ? 55 : width === 375 ? 90 : 93,
}) })
await expect(taskRowLocator).toHaveCount(1) await expect(taskRowLocator).toHaveCount(1)
await expect(habitRowLocator).toHaveCount(1) await expect(habitRowLocator).toHaveCount(1)
@@ -188,9 +188,9 @@ test('Today plain-list layout matches the approved responsive geometry', async (
expect(metrics.styles.filterBorderRadius).toBe('0px') expect(metrics.styles.filterBorderRadius).toBe('0px')
expect(metrics.styles.fabShadow).toContain('8px 18px') expect(metrics.styles.fabShadow).toContain('8px 18px')
expect(metrics.styles.fabIconWidth).toBeCloseTo(30, 0) expect(metrics.styles.fabIconWidth).toBeCloseTo(30, 0)
if (width === 721) { if (width >= 721) {
expect(metrics.uniqueRows).toHaveLength(1) expect(metrics.uniqueRows).toHaveLength(1)
expect(metrics.content.width).toBeCloseTo(630, 0) expect(metrics.content.width).toBeCloseTo(width >= 1440 ? 900 : 630, 0)
expect(metrics.environment.height).toBeLessThanOrEqual(72) expect(metrics.environment.height).toBeLessThanOrEqual(72)
expect(metrics.styles.titleFontSize).toBe('34px') expect(metrics.styles.titleFontSize).toBe('34px')
} else { } else {
@@ -207,8 +207,8 @@ test('Today plain-list layout matches the approved responsive geometry', async (
} }
} }
if (width >= 721) { if (width >= 721) {
expect(metrics.content.width).toBeLessThanOrEqual(721) expect(metrics.content.width).toBeLessThanOrEqual(width >= 1440 ? 900 : 721)
expect(Math.abs(metrics.content.left - (width - metrics.content.width) / 2)).toBeLessThanOrEqual(2) expect(Math.abs(metrics.content.left - (metrics.main.left + (metrics.main.width - metrics.content.width) / 2))).toBeLessThanOrEqual(2)
} }
} }
}) })
+2
View File
@@ -59,6 +59,8 @@ describe('Today environment integration', () => {
expect(app).toContain("'today-active': activeView==='today'") expect(app).toContain("'today-active': activeView==='today'")
expect(css).toContain('.shell.today-active .unified-fab{box-shadow:0 8px 18px rgba(174,65,29,.22)}') expect(css).toContain('.shell.today-active .unified-fab{box-shadow:0 8px 18px rgba(174,65,29,.22)}')
expect(css).not.toContain('\n.unified-fab{box-shadow:0 8px 18px rgba(174,65,29,.22)}') expect(css).not.toContain('\n.unified-fab{box-shadow:0 8px 18px rgba(174,65,29,.22)}')
expect(css).toContain('main.today-main{padding-left:max(44px,calc((100% - 900px)/2));padding-right:max(44px,calc((100% - 900px)/2))}')
expect(css).toContain('@media(max-width:930px){main.today-main{padding-left:max(44px,calc((100% - 630px)/2));padding-right:max(44px,calc((100% - 630px)/2))}}')
expect(css).toContain('@media(max-width:720.98px){main.today-main{padding-left:29px!important;padding-right:29px!important}') expect(css).toContain('@media(max-width:720.98px){main.today-main{padding-left:29px!important;padding-right:29px!important}')
expect(css).toContain('.today-context{margin:0 0 14px;border-bottom:0}') expect(css).toContain('.today-context{margin:0 0 14px;border-bottom:0}')
expect(css).toContain('.today-remaining{margin:0 0 24px;color:var(--muted);font-size:13px}') expect(css).toContain('.today-remaining{margin:0 0 24px;color:var(--muted);font-size:13px}')
File diff suppressed because one or more lines are too long