refactor: unify mobile sheet patterns
This commit is contained in:
@@ -30,6 +30,30 @@ describe('mobile navigation styles', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('mobile sheet contract', () => {
|
||||
it('uses shared roles for details, creation and secondary actions', () => {
|
||||
expect(app).toContain('class="task-compose-mask app-sheet-mask"')
|
||||
expect(app).toContain('class="task-compose-sheet app-sheet app-sheet--create"')
|
||||
expect(app).toContain('class="more-sheet app-sheet app-sheet--actions"')
|
||||
expect(mvpPanel).toContain('class="task-compose-sheet habit-compose-sheet app-sheet app-sheet--create"')
|
||||
expect(mvpPanel).toContain('class="habit-detail-sheet app-sheet app-sheet--detail"')
|
||||
expect(countdownPanel).toContain('class="countdown-detail-sheet app-sheet app-sheet--detail"')
|
||||
expect(countdownPanel).toContain('class="countdown-modal app-sheet app-sheet--create"')
|
||||
expect(css).toContain('--sheet-radius:20px;--sheet-scrim:rgba(45,38,31,.4)')
|
||||
expect(css).toContain('.app-sheet-mask.app-sheet-mask{background:var(--sheet-scrim)')
|
||||
expect(css).toContain('.app-sheet__header{min-height:64px;')
|
||||
expect(css).toContain('.app-sheet__body{min-height:0;overflow-y:auto;')
|
||||
expect(css).toContain('.app-sheet__footer{position:sticky;bottom:0;')
|
||||
expect(css).toContain('padding-bottom:calc(16px + env(safe-area-inset-bottom))')
|
||||
})
|
||||
|
||||
it('keeps destructive actions in a separate bottom danger zone', () => {
|
||||
expect(mvpPanel).toContain('class="app-sheet__danger"')
|
||||
expect(mvpPanel).toMatch(/app-sheet__danger[\s\S]*?deleteHabit\(selectedHabit\)/)
|
||||
expect(css).toContain('.app-sheet__danger{border-top:1px solid #f1d4cd;')
|
||||
})
|
||||
})
|
||||
|
||||
describe('mobile list row language', () => {
|
||||
it('uses one quiet bordered row surface for tasks, habits, and countdowns on mobile', () => {
|
||||
expect(css).toContain('@media(max-width:930px){.task-row,.habit-row,.countdown-row{')
|
||||
@@ -45,8 +69,8 @@ describe('mobile list row language', () => {
|
||||
|
||||
it('keeps destructive habit actions in a detail sheet instead of the list row', () => {
|
||||
expect(mvpPanel).not.toContain('<button class="icon ghost" aria-label="归档习惯"')
|
||||
expect(mvpPanel).toContain('class="habit-detail-mask"')
|
||||
expect(mvpPanel).toContain('class="habit-detail-sheet"')
|
||||
expect(mvpPanel).toContain('class="habit-detail-mask app-sheet-mask"')
|
||||
expect(mvpPanel).toContain('class="habit-detail-sheet app-sheet app-sheet--detail"')
|
||||
expect(mvpPanel).toContain('@click="archiveHabit(selectedHabit)"')
|
||||
expect(mvpPanel).toContain('@click="deleteHabit(selectedHabit)"')
|
||||
expect(mvpPanel).toContain('永久删除')
|
||||
|
||||
Reference in New Issue
Block a user