feat: add standalone memos
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const app = readFileSync('src/App.vue', 'utf8')
|
||||
const css = readFileSync('src/memo.css', 'utf8')
|
||||
const panel = readFileSync('src/MemoPanel.vue', 'utf8')
|
||||
const editor = readFileSync('src/components/MemoEditor.vue', 'utf8')
|
||||
|
||||
describe('memo shell integration', () => {
|
||||
it('places Memos immediately after Countdowns in desktop navigation and keeps mobile tabs unchanged', () => {
|
||||
const nav = app.slice(app.indexOf('<nav class="primary-nav">'), app.indexOf('</nav>', app.indexOf('<nav class="primary-nav">')))
|
||||
expect(nav.indexOf("switchView('memos')")).toBeGreaterThan(nav.indexOf("switchView('countdowns')"))
|
||||
expect(nav.match(/switchView\('memos'\)/g)).toHaveLength(1)
|
||||
const bottom = app.slice(app.indexOf('<nav class="bottom"'), app.indexOf('</nav>', app.indexOf('<nav class="bottom"')))
|
||||
expect(bottom).not.toContain("switchView('memos')")
|
||||
expect(bottom.match(/aria-current=/g)).toHaveLength(4)
|
||||
})
|
||||
|
||||
it('routes the shared cat FAB to memo creation and hides it in memo trash', () => {
|
||||
expect(app).toContain("activeView.value === 'memos'")
|
||||
expect(app).toContain('memoPanel.value?.createMemo()')
|
||||
expect(app).toContain(':show="activeView!==\'memos\' || !memoTrash"')
|
||||
expect(panel).toContain("scope.value === 'trash'")
|
||||
})
|
||||
|
||||
it('keeps memo UI componentized and task detail copy explicit', () => {
|
||||
expect(app).toContain("import MemoPanel from './MemoPanel.vue'")
|
||||
expect(panel).toContain("import MemoRow")
|
||||
expect(panel).toContain("import MemoEditor")
|
||||
expect(app).toContain('<span>任务详情</span>')
|
||||
expect(app).toContain('<div class="field-label"><span>任务备注</span>')
|
||||
})
|
||||
|
||||
it('uses a 350px desktop detail, near-full mobile sheet, continuous rows and reduced motion', () => {
|
||||
expect(css).toContain('.memo-editor{width:350px')
|
||||
expect(css).toContain('.memo-list{display:grid;gap:0')
|
||||
expect(css).toContain('.memo-row+.memo-row{border-top:1px solid var(--border-cream)}')
|
||||
expect(css).toContain('@media(max-width:930px){.memo-panel{')
|
||||
expect(css).toContain('.memo-editor{position:fixed;z-index:42;left:0;right:0;top:auto')
|
||||
expect(css).toContain('height:min(92dvh,820px)')
|
||||
expect(css).toContain('@media(prefers-reduced-motion:reduce){.memo-editor')
|
||||
expect(editor).toContain("window.addEventListener('beforeunload'")
|
||||
expect(editor).toContain("event.key !== 'Tab'")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user