feat: simplify today into plain list
This commit is contained in:
@@ -46,23 +46,42 @@ describe('Today environment integration', () => {
|
||||
expect(css).not.toContain('.today-environment__refreshing')
|
||||
})
|
||||
|
||||
it('renders方案 A as the selected landing-page paper composition', () => {
|
||||
expect(app.match(/class="today-board"/g)).toHaveLength(1)
|
||||
expect(app).toContain('<section v-if="activeView===\'today\'" class="today-board" aria-labelledby="today-board-title">')
|
||||
expect(app).toContain('<h2 id="today-board-title" class="sr-only">今日纸笺</h2>')
|
||||
expect(app).toContain('<div class="today-board__progress" aria-label="今日任务与习惯进度">')
|
||||
expect(app).toContain('<span>还有 {{ todayTaskRemaining }} 项</span>')
|
||||
expect(app).toContain('<span>还有 {{ todayHabitRemaining }} 项</span>')
|
||||
expect(app).toMatch(/today-board__progress[\s\S]*today-task-track[\s\S]*today-habit-track[\s\S]*<\/div>/)
|
||||
expect(css).toMatch(/\.today-board\{[^}]*padding:0 18px 16px/)
|
||||
expect(css).toMatch(/\.today-board__progress\{[^}]*display:grid[^}]*grid-template-columns:repeat\(2,minmax\(0,1fr\)\)/)
|
||||
expect(css).toContain('.today-track:first-child{padding-left:0;padding-right:18px}')
|
||||
expect(css).toContain('.today-track:last-child{padding-right:0;padding-left:18px;border-left:1px solid var(--line)}')
|
||||
expect(css).not.toMatch(/@media\(max-width:720px\)\{\.today-board\{[^}]*padding:/)
|
||||
expect(css).not.toMatch(/@media\(max-width:930px\)[\s\S]*?\.today-track-head\{[^}]*flex-direction:column/)
|
||||
expect(css).toContain('.today-track-rail{display:block;height:5px;overflow:hidden;border-radius:999px;background:#eee5d9}')
|
||||
expect(css).toContain('.today-track-fill{display:block;width:0;height:100%;border-radius:inherit;background:var(--success)')
|
||||
expect(css).not.toMatch(/\.today-(?:board|track)[^{]*\{[^}]*(?:gradient|backdrop-filter)/)
|
||||
it('renders the approved plain-list composition without a board or progress tracks', () => {
|
||||
expect(app).toContain('<main :class="{\'today-main\':activeView===\'today\'}"')
|
||||
expect(app).toContain('<section v-if="activeView===\'today\'" class="today-context" aria-label="今日概览">')
|
||||
expect(app).toContain('<p class="today-remaining">还有 {{ todayTaskRemaining + todayHabitRemaining }} 项待完成</p>')
|
||||
expect(app).not.toContain('class="today-board"')
|
||||
expect(app).not.toContain('today-board-title')
|
||||
expect(app).not.toContain('today-board__progress')
|
||||
expect(app).not.toContain('today-task-track')
|
||||
expect(app).not.toContain('today-habit-track')
|
||||
expect(app).not.toContain('role="progressbar"')
|
||||
expect(css).toContain('main.today-main{padding-left:max(34px,calc((100% - 720px)/2));padding-right:max(34px,calc((100% - 720px)/2))}')
|
||||
expect(css).toContain('.today-context{margin:0 0 8px;border-bottom:1px solid var(--line)}')
|
||||
expect(css).toContain('.today-remaining{margin:7px 0 10px;color:var(--muted);font-size:13px}')
|
||||
expect(css).not.toContain('.today-board{')
|
||||
expect(css).not.toContain('.today-board__progress{')
|
||||
expect(css).not.toContain('.today-track{')
|
||||
expect(css).not.toContain('.today-track-rail{')
|
||||
})
|
||||
|
||||
it('renders the approved plain-list DOM in prototype order without duplicating the Today title', () => {
|
||||
const main = app.slice(app.indexOf('<main :class='), app.indexOf('</main>'))
|
||||
const environment = main.indexOf('<TodayEnvironmentStrip')
|
||||
const title = main.indexOf('<h1 class="today-page-title">今天</h1>')
|
||||
const remaining = main.indexOf('<p class="today-remaining">')
|
||||
const filter = main.indexOf('<CompletedFilterPill v-model="showCompleted" class="today-inline-filter" />')
|
||||
const overdue = main.indexOf('id="today-overdue-heading"')
|
||||
expect(environment).toBeGreaterThan(-1)
|
||||
expect(title).toBeGreaterThan(environment)
|
||||
expect(remaining).toBeGreaterThan(title)
|
||||
expect(filter).toBeGreaterThan(remaining)
|
||||
expect(overdue).toBeGreaterThan(filter)
|
||||
expect(main.match(/>今天<\/h1>/g)).toHaveLength(1)
|
||||
expect(main).toContain("<div v-if=\"activeView!=='today'\" class=\"topbar-title\"><h1")
|
||||
expect(main).toContain("<div v-if=\"['today', 'tasks', 'upcoming', 'habits'].includes(activeView)\" class=\"topbar-actions\">")
|
||||
expect(main).toContain('<CompletedFilterPill v-if="activeView!==\'today\'" v-model="showCompleted" class="topbar-filter" />')
|
||||
expect(main).toContain('aria-label="刷新当前页面"')
|
||||
})
|
||||
|
||||
it('keeps the editorial environment layout readable at desktop and narrow widths', () => {
|
||||
|
||||
Reference in New Issue
Block a user