fix(acceptance): 首轮 Windows 验收 7 项缺陷回修(docs/14)
P0 快捷键让行判定补 recoveryDismissed,点过「稍后再说」不再全失效; P1 冲突重载加 force 绕过防竞态守卫;路径分隔符 joinPath 原生化 + samePath 归一化比较;.source-cm 补文档字色; P2 turndown 启用 GFM 插件(HTML 导入不再丢表格);任务复选框去掉 click preventDefault(浏览器激活撤销覆盖视觉同步); P3 新增 syncEditorContent:干净标签的挂载/卸载序列化回写同步基线, 切标签不再误标未保存。vitest 74 通过 + 2 跳过。
This commit is contained in:
@@ -100,3 +100,26 @@ describe('粘贴与锚点修复(审计)', () => {
|
||||
expect(findBlockIndex(blocks, { blockText: '目标文本', offsetInBlock: 0 })).toBe(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('验收回修回归', () => {
|
||||
it('任务复选框点击后视觉 checked 与文档同步(C3)', async () => {
|
||||
const { host, editor } = await makeEditor('- [ ] 待办一\n- [x] 已办')
|
||||
const box = host.querySelector<HTMLInputElement>('input.task-checkbox')
|
||||
expect(box).not.toBeNull()
|
||||
expect(box!.checked).toBe(false)
|
||||
box!.click()
|
||||
expect(box!.checked).toBe(true)
|
||||
expect(getMarkdown(editor)).toContain('- [x] 待办一')
|
||||
await editor.destroy()
|
||||
host.remove()
|
||||
})
|
||||
|
||||
it('HTML 导入保留 GFM 表格(E6)', async () => {
|
||||
const { htmlToMarkdown } = await import('../src/services/exportHtml')
|
||||
const md = await htmlToMarkdown('<h1>标题</h1><table><thead><tr><th>列一</th><th>列二</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table>')
|
||||
expect(md).toContain('# 标题')
|
||||
expect(md).toContain('| 列一 | 列二 |')
|
||||
expect(md).toMatch(/\| -+ \| -+ \|/)
|
||||
expect(md).toContain('| 1 | 2 |')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -61,3 +61,20 @@ describe('标签页会话模型', () => {
|
||||
expect(s.tabs[0].id).toBe(t3.id === s.tabs[0].id ? t3.id : s.tabs[0].id)
|
||||
})
|
||||
})
|
||||
|
||||
describe('syncEditorContent(验收 P3 回归)', () => {
|
||||
it('干净标签的规范化回写同步基线、不标脏;脏标签只更新正文', () => {
|
||||
const t = createTab({ content: '| A |\n|---|\n| 1 |' })
|
||||
let s: TabsState = { tabs: [t], activeId: t.id }
|
||||
// 挂载序列化把对齐冒号规范化了:干净标签基线跟随,仍不脏
|
||||
s = tabsReducer(s, { type: 'syncEditorContent', id: t.id, content: '| A |\n|:---|\n| 1 |' })
|
||||
expect(isDirty(s.tabs[0])).toBe(false)
|
||||
expect(s.tabs[0].content).toContain(':---')
|
||||
// 脏标签:只更新正文,基线不动
|
||||
s = tabsReducer(s, { type: 'updateContent', id: t.id, content: '改过' })
|
||||
expect(isDirty(s.tabs[0])).toBe(true)
|
||||
s = tabsReducer(s, { type: 'syncEditorContent', id: t.id, content: '改过又回写' })
|
||||
expect(s.tabs[0].savedContent).toContain(':---')
|
||||
expect(isDirty(s.tabs[0])).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user