fix: expand Today desktop layout
ci / gitleaks (push) Successful in 8s
ci / docker (push) Successful in 3m35s

This commit is contained in:
2026-09-18 09:40:28 +08:00
parent 28698a47b7
commit 6d568273ef
3 changed files with 19 additions and 7 deletions
+15 -4
View File
@@ -1,7 +1,7 @@
import type { APIRequestContext } from '@playwright/test'
import { expect, test } from './fixtures'
const widths = [1440, 721, 720, 390, 375]
const widths = [1600, 1440, 721, 720, 390, 375]
async function csrf(request: APIRequestContext) {
const state = await request.storageState()
@@ -50,7 +50,7 @@ test('Today plain-list layout matches the approved responsive geometry', async (
}
})).toEqual({
media720: width <= 720,
contentWidth: width >= 1440 ? 900 : width === 721 ? 630 : width - 58,
contentWidth: width >= 1440 ? 1080 : width === 721 ? 630 : width - 58,
environmentHeight: width >= 721 ? 55 : width === 375 ? 90 : 93,
})
await expect(taskRowLocator).toHaveCount(1)
@@ -120,6 +120,8 @@ test('Today plain-list layout matches the approved responsive geometry', async (
content: { left: content.left, right: content.right, width: content.width },
environment: { ...environment.getBoundingClientRect().toJSON(), scrollWidth: environment.scrollWidth, clientWidth: environment.clientWidth },
directions: { calendar: getComputedStyle(calendar).flexDirection, weather: getComputedStyle(weather).flexDirection, gold: getComputedStyle(gold).flexDirection },
itemWidths: [calendar, weather, gold].map((element) => element.getBoundingClientRect().width),
itemHeights: [calendar, weather, gold].map((element) => element.getBoundingClientRect().height),
uniqueRows,
collisions,
collisionRects: [calendar, weather, gold].map(element => element.getBoundingClientRect().toJSON()),
@@ -190,11 +192,20 @@ test('Today plain-list layout matches the approved responsive geometry', async (
expect(metrics.styles.fabIconWidth).toBeCloseTo(30, 0)
if (width >= 721) {
expect(metrics.uniqueRows).toHaveLength(1)
expect(metrics.content.width).toBeCloseTo(width >= 1440 ? 900 : 630, 0)
expect(metrics.content.width).toBeCloseTo(width >= 1440 ? 1080 : 630, 0)
expect(Math.max(...metrics.itemWidths) - Math.min(...metrics.itemWidths)).toBeLessThanOrEqual(1)
expect(Math.max(...metrics.itemHeights) - Math.min(...metrics.itemHeights)).toBeLessThanOrEqual(1)
expect(metrics.environment.height).toBeLessThanOrEqual(72)
expect(metrics.styles.titleFontSize).toBe('34px')
} else {
expect(metrics.uniqueRows).toHaveLength(2)
expect(metrics.collisionRects[0].width).toBeCloseTo(metrics.content.width, 0)
expect(metrics.collisionRects[0].left).toBeCloseTo(metrics.content.left, 0)
expect(metrics.collisionRects[0].right).toBeCloseTo(metrics.content.right, 0)
expect(metrics.collisionRects[1].width).toBeCloseTo(metrics.collisionRects[2].width, 0)
expect(metrics.collisionRects[1].left).toBeCloseTo(metrics.content.left, 0)
expect(metrics.collisionRects[2].right).toBeCloseTo(metrics.content.right, 0)
expect(metrics.collisionRects[1].right).toBeCloseTo(metrics.collisionRects[2].left, 0)
expect(metrics.directions.calendar).toBe('row')
expect(metrics.directions.weather).toBe('column')
expect(metrics.directions.gold).toBe('column')
@@ -207,7 +218,7 @@ test('Today plain-list layout matches the approved responsive geometry', async (
}
}
if (width >= 721) {
expect(metrics.content.width).toBeLessThanOrEqual(width >= 1440 ? 900 : 721)
expect(metrics.content.width).toBeLessThanOrEqual(width >= 1440 ? 1080 : 721)
expect(Math.abs(metrics.content.left - (metrics.main.left + (metrics.main.width - metrics.content.width) / 2))).toBeLessThanOrEqual(2)
}
}