refactor: unify task and habit list rows
This commit is contained in:
@@ -34,14 +34,40 @@ describe('approved five-detail polish', () => {
|
||||
expect(css).toMatch(/@media\(max-width:930px\)\{[\s\S]*?\.countdown-focus\{[^}]*height:140px/)
|
||||
})
|
||||
|
||||
it('keeps every desktop and mobile task row at the approved height', () => {
|
||||
const polishStart = css.indexOf('/* Approved five-detail list/search polish. */')
|
||||
const polish = css.slice(polishStart)
|
||||
expect(polish).toContain('}\n.task-row{min-height:66px;height:66px;max-height:68px}')
|
||||
expect(polish).toContain('.habit-row{min-height:86px;height:86px;max-height:88px}')
|
||||
expect(polish).toContain('.today-habit-row{min-height:86px;height:86px;max-height:88px}')
|
||||
expect(memoCss).toContain('.memo-row{width:100%;height:74px;min-height:74px;max-height:76px;')
|
||||
it('uses one 58px plain-list contract for active task and habit rows', () => {
|
||||
expect(app).toContain("class=\"task-list plain-list\"")
|
||||
expect(app).toContain("'task-row--trash':activeView==='trash'")
|
||||
expect(app).toContain(':role="activeView===\'trash\' ? undefined : \'button\'"')
|
||||
expect(app).toContain(':tabindex="activeView===\'trash\' ? undefined : 0"')
|
||||
expect(app).toContain('@click="activeView===\'trash\'?undefined:selectTaskUnlessSwiped(node.task)"')
|
||||
expect(app).toContain('v-if="activeView!==\'trash\'" class="task-check"')
|
||||
expect(habits).toContain('class=\"habit-list plain-list\"')
|
||||
expect(habits).toContain('class=\"habit-row habit-row--full swipeable\"')
|
||||
expect(css).toContain('.plain-list{display:grid;gap:0;background:transparent;border:0;border-radius:0;box-shadow:none;overflow:visible}')
|
||||
expect(css).toContain('.plain-list-row,.plain-list>.task-row,.plain-list>.habit-row{height:58px;min-height:58px;max-height:58px;background:transparent;border:0;border-bottom:1px solid #e8e0d5;border-radius:0;box-shadow:none}')
|
||||
expect(css).toContain('.task-row{grid-template-columns:44px minmax(0,1fr) auto}')
|
||||
expect(css).toContain('.habit-row{grid-template-columns:44px minmax(0,1fr) auto}')
|
||||
expect(css).toContain('.task-main strong,.habit-name{display:block;min-width:0;font-size:15px;font-weight:400;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}')
|
||||
expect(css).toContain('.task-tail,.habit-row-meta{min-width:0;max-width:132px;padding-left:12px;font-size:12px;font-weight:400;white-space:nowrap;text-align:right;overflow:hidden;text-overflow:ellipsis}')
|
||||
expect(css).toContain('.task-check{width:44px;')
|
||||
expect(css).toContain('.plain-list .habit-check{margin-left:0}')
|
||||
expect(memoCss).toContain('.memo-row{width:100%;height:74px;min-height:74px;max-height:76px;')
|
||||
})
|
||||
|
||||
it('moves habit history out of every active list row and retains a visible status tail', () => {
|
||||
const todayRows = habits.slice(habits.indexOf('class="habit-list plain-list today-habit-list"'), habits.indexOf('<!-- 完整习惯列表 -->'))
|
||||
const fullRows = habits.slice(habits.indexOf('class="habit-list plain-list">'), habits.indexOf('class="habit-archive-section"'))
|
||||
for (const rows of [todayRows, fullRows]) {
|
||||
expect(rows).not.toContain('habit-week')
|
||||
expect(rows).not.toContain('habit-progress-bar')
|
||||
expect(rows).not.toContain('habit-state-note')
|
||||
expect(rows).toContain('class="habit-row-meta"')
|
||||
expect(rows).toContain(':aria-label="habitRowStatus(h)"')
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps plain-list task and habit rows transparent in all persistent states', () => {
|
||||
expect(css).toContain('.plain-list>.task-row:hover,.plain-list>.task-row.selected,.plain-list>.task-row.done,.plain-list>.habit-row:hover,.plain-list>.habit-row.done,.plain-list>.overdue-task{background:transparent}')
|
||||
})
|
||||
|
||||
it('renders memo rows with title and time only at a fixed compact height', () => {
|
||||
|
||||
Reference in New Issue
Block a user