fix: refine mobile navigation and settings
ci / gitleaks (push) Successful in 7s
ci / docker (push) Successful in 3m27s

This commit is contained in:
2026-09-10 10:38:39 +08:00
parent 125e6d3a61
commit 7c05ec2a85
6 changed files with 136 additions and 9 deletions
+41
View File
@@ -17,6 +17,13 @@ describe('mobile navigation styles', () => {
expect(app).toContain('<span>设置</span>')
})
it('marks only exact mobile destinations active and exposes aria-current only there', () => {
for (const view of ['today', 'habits', 'countdowns', 'settings']) {
expect(app).toContain(`:class="{active:activeView==='${view}'}" :aria-current="activeView==='${view}' ? 'page' : undefined"`)
}
expect(app).not.toContain("activeView==='tasks'||activeView==='upcoming'||activeView==='trash'||activeView==='settings'")
})
it('keeps the mobile More sheet visible when it is rendered', () => {
expect(css).not.toContain('.more-mask{display:none}')
expect(css).toContain('@media(max-width:930px){.shell')
@@ -31,6 +38,40 @@ describe('mobile navigation styles', () => {
})
})
describe('settings sessions and audit activity', () => {
it('renders readable session metadata, local time, and an accessible revoke action', () => {
expect(mvpPanel).toContain('class="session-copy"')
expect(mvpPanel).toContain('class="session-title"')
expect(mvpPanel).toContain('class="session-meta"')
expect(mvpPanel).toContain('class="session-device"')
expect(mvpPanel).toContain(':datetime="s.last_seen_at ?? s.created_at"')
expect(mvpPanel).toContain(':aria-label="`撤销 ${formatUserAgent(s.user_agent)} 的登录会话`"')
expect(mvpPanel).toContain('class="danger-text session-revoke"')
})
it('does not expose the raw user agent in session DOM attributes', () => {
expect(mvpPanel).not.toContain(':title="s.user_agent || undefined"')
expect(mvpPanel).not.toMatch(/<span class="session-device"[^>]*s\.user_agent[^>]*>/)
expect(mvpPanel).toContain('<span class="session-device">{{ formatUserAgent(s.user_agent) }}</span>')
})
it('renders localized audit copy and semantic local time', () => {
expect(mvpPanel).toContain('class="audit-copy"')
expect(mvpPanel).toContain('class="audit-action"')
expect(mvpPanel).toContain("formatAuditAction(row.action ?? row.event)")
expect(mvpPanel).toContain('formatAuditEntity(row.entity_type)')
expect(mvpPanel).toContain(':datetime="row.created_at ?? row.timestamp"')
})
it('keeps revoke and all existing drag handles at 44px without enlarging icons', () => {
expect(css).toContain('.drag-handle{width:44px;min-width:44px;height:44px;flex:0 0 44px;')
expect(css).toContain('.drag-handle svg{width:17px;height:17px}')
expect(css).not.toContain('.drag-handle{width:36px;flex-basis:36px}')
expect(css).toContain('.session-copy{min-width:0;flex:1;')
expect(css).toContain('.session-revoke{min-width:44px;min-height:44px;flex:0 0 auto;')
})
})
describe('solid cream material system', () => {
it('defines three opaque cream surfaces, warm borders, restrained depth, and the radius scale', () => {
expect(css).toContain('--surface-canvas:#f6f0e5')