feat: 更新统计卡片与分组对应关系,优化样式与可访问性
CI / verify (push) Successful in 1m41s
CI / 部署到服务器 (push) Successful in 26s

This commit is contained in:
chenshoulin
2026-10-24 18:31:45 +08:00
parent 81ef0cc43f
commit 300b2de37e
7 changed files with 158 additions and 98 deletions
+27 -2
View File
@@ -113,10 +113,26 @@ describe('截止日期', () => {
})
describe('已完成样式', () => {
it('标题加删除线并整体降饱和', () => {
it('标题加删除线,但不再整卡降透明度', () => {
const wrapper = mountCard({ status: 'done' })
const classes = wrapper.find('article').classes().join(' ')
expect(wrapper.find('h3').classes().join(' ')).toContain('line-through')
expect(wrapper.find('article').classes().join(' ')).toContain('opacity-60')
// 整卡 opacity-60 会把标题压到 1.69:1、标签压到 1.61:1(WCAG AA 要求 4.5:1)
expect(classes).not.toContain('opacity-60')
expect(classes).toContain('bg-white')
})
it('已完成卡片的文字不低于 slate-500', () => {
const wrapper = mountCard({ status: 'done', priority: 1, tags: ['设计'] })
const html = wrapper.html()
expect(wrapper.find('h3').classes().join(' ')).toContain('text-slate-500')
// 标签与「低」优先级曾用 slate-400(白底 2.56:1),统一提到 slate-500(4.76:1)
expect(html).not.toContain('text-slate-400')
expect(html).toContain('text-slate-500')
// 完成日期曾带 /80 透明度,混色后 3.75:1
expect(html).not.toContain('emerald-700/80')
})
it('未完成时不加删除线', () => {
@@ -189,6 +205,15 @@ describe('交互', () => {
expect(mountCard({ status: 'done' }).find('button').attributes('aria-pressed')).toBe('true')
})
it('勾选按钮的命中区不小于 24×24(视觉仍是 16px 圆点)', () => {
const button = mountCard().find('button')
// WCAG 2.5.8:命中区 24×24 起;视觉尺寸由内层 span 保持 size-4
expect(button.classes().join(' ')).toContain('h-9')
expect(button.classes().join(' ')).toContain('w-8')
expect(button.find('span').classes().join(' ')).toContain('size-4')
})
it('点击卡片 emit open 而不是 toggle', async () => {
const wrapper = mountCard({ id: 'task-7' })
await wrapper.find('article').trigger('click')