feat: redesign calendar around weekly focus
ci / gitleaks (push) Successful in 1m19s
ci / docker (push) Successful in 5m5s

This commit is contained in:
2026-09-20 17:23:02 +08:00
parent f3ad1eec03
commit 7140102aeb
4 changed files with 105 additions and 24 deletions
+20
View File
@@ -200,6 +200,26 @@ test('all bottom destinations expose one active page and desktop layout stays un
expect(desktopBottomGap).toBe(84)
})
test('calendar week focus keeps seven usable day controls without page overflow', async ({ page }) => {
await page.route('**/api/v1/calendar-subscriptions', route => route.fulfill({ json: [{ id:'calendar-source', name:'工作', url:'https://example.com/work.ics', color:'#f15a29', enabled:true, refreshed_at:null, last_error:null, stale:false }] }))
await page.route('**/api/v1/calendar-events?*', route => route.fulfill({ json: { events: [], sources: [] } }))
await page.goto('/')
const mobile = (await page.viewportSize())!.width <= 930
if (mobile) await bottomTab(page, '日历订阅').click()
else await page.locator('.primary-nav').getByRole('button', { name: '日历订阅', exact: true }).click()
const strip = page.getByRole('group', { name: '选择日期' })
await expect(strip).toBeVisible()
await expect(strip.locator('.calendar-week-day')).toHaveCount(7)
const metrics = await strip.evaluate(element => ({
documentOverflow: document.documentElement.scrollWidth - document.documentElement.clientWidth,
stripOverflow: element.scrollWidth > element.clientWidth,
buttons: [...element.querySelectorAll<HTMLElement>('.calendar-week-day')].map(button => ({ width: button.getBoundingClientRect().width, height: button.getBoundingClientRect().height })),
}))
expect(metrics.documentOverflow).toBe(0)
expect(metrics.buttons.every(button => button.width >= 44 && button.height >= 44)).toBeTruthy()
if ((await page.viewportSize())!.width <= 390) expect(metrics.stripOverflow).toBeTruthy()
})
test('settings match the approved paper-ledger geometry and action hierarchy', async ({ page }) => {
await page.goto('/')
await openSettings(page)