feat: 补齐今日视图待办组、卡片键盘操作、深色模式
今日视图 - 补上「待办」组。此前只收 逾期 / 今天到期 / 进行中,导致待办列里没设 截止日期的任务在今日视图里完全消失 —— 用户明明有一堆事没做,却看到 「今天没有待办事项」。现在只要任务未完成且未归档,就必定出现在某个 分组里(归属优先级:逾期 > 今天到期 > 进行中 > 待办)。 - 统计卡片改为与分组一一对应(逾期 / 今天到期 / 进行中 / 本周完成), 不再用「今日待办」这种把四组混在一起、与列表长度对不上的指标。 键盘操作(可访问性) - 卡片可聚焦(Tab / 点击),← → 换列、↑ ↓ 列内调序、Enter 打开详情。 - 换列时追加到目标列末尾:用全量长度而不是可见下标,筛选态下也安全; 列内调序要求该列渲染的是全量,否则禁用(与拖拽的规则一致)。 - 移动后手动恢复焦点 —— 卡片跨列会被重建,不恢复的话连续按键会失效。 深色模式 - 三态:跟随系统 / 浅色 / 深色,选择持久化到 localStorage。 - index.html 内联脚本在首帧之前应用主题,避免深色下闪白。 - 用 @custom-variant dark 做 class 控制(而不是纯 media query), 才能支持「强制浅色」;html 的 color-scheme 让原生控件与滚动条跟随。 验证:单元测试 480 个、端到端测试 25 个全部通过,lint 与构建无错误。 截图脚本新增深色与移动端深色两组,便于后续对照。
This commit is contained in:
@@ -113,3 +113,39 @@ test('输入框内输入不会触发快捷键', async ({ page }) => {
|
||||
await expect(search).toBeFocused()
|
||||
await expect(search).toHaveValue('n')
|
||||
})
|
||||
|
||||
test('深色模式可切换并在刷新后保持', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
const html = page.locator('html')
|
||||
const themeButton = page.getByRole('button', { name: /主题/ })
|
||||
|
||||
await expect(html).not.toHaveClass(/dark/)
|
||||
|
||||
// 系统 → 浅色 → 深色
|
||||
await themeButton.click()
|
||||
await expect(html).not.toHaveClass(/dark/)
|
||||
await themeButton.click()
|
||||
await expect(html).toHaveClass(/dark/)
|
||||
|
||||
await page.reload()
|
||||
await expect(html).toHaveClass(/dark/)
|
||||
|
||||
// 再点一次回到跟随系统
|
||||
await themeButton.click()
|
||||
await expect(html).not.toHaveClass(/dark/)
|
||||
})
|
||||
|
||||
test('键盘方向键可以移动任务卡片', async ({ page }) => {
|
||||
await addTask(page, '键盘移动我')
|
||||
const card = page.locator('article').filter({ hasText: '键盘移动我' })
|
||||
await card.focus()
|
||||
|
||||
await page.keyboard.press('ArrowRight')
|
||||
await expect(page.locator('[data-column-id="doing"] article')).toHaveCount(1)
|
||||
|
||||
await page.keyboard.press('ArrowLeft')
|
||||
await expect(page.locator('[data-column-id="todo"] article')).toHaveCount(1)
|
||||
|
||||
await page.reload()
|
||||
await expect(page.locator('[data-column-id="todo"] article')).toHaveCount(1)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user