fix(audit): 审计问题全量修复(docs/12)
高危逻辑 A1-A10:saved 写盘快照、重载卸载回写闸门与期望值校验、 ?file 无条件打开、偏好读后才写+防抖、depth=0 守卫、查找命中随编辑 作废、自动保存避让冲突标签、搜索防链接环、重 IO 命令异步化+上限。 样式:--panel 更正为 --bg-panel、新增 .input 基础样式、文档主题 纸面/字色成对、打印隐藏清单补全、paperTone 驱动源码明暗。 性能:状态栏/大纲按正文 memo、大纲延后提取、Sidebar memo、专注 装饰映射复用、查找防抖、图片 base64 过 IPC。 中危一批:关窗落盘后放行、回收站去向明示、GBK 搜索、create_new 落盘、Mermaid 渲染代次守卫、多行粘贴分段等。 回归:新增 tabkey/audit-fix 集成测试(E1 Tab 抢先定性排除), vitest 71 通过 + 2 跳过。
This commit is contained in:
@@ -24,11 +24,21 @@ describe('标签页会话模型', () => {
|
||||
s = tabsReducer(s, { type: 'updateContent', id: t.id, content: '原文' })
|
||||
expect(isDirty(s.tabs[0])).toBe(false)
|
||||
s = tabsReducer(s, { type: 'updateContent', id: t.id, content: '新版' })
|
||||
s = tabsReducer(s, { type: 'saved', id: t.id })
|
||||
s = tabsReducer(s, { type: 'saved', id: t.id, savedContent: '新版' })
|
||||
expect(isDirty(s.tabs[0])).toBe(false)
|
||||
expect(s.tabs[0].savedContent).toBe('新版')
|
||||
})
|
||||
|
||||
it('保存竞态:写盘期间的新输入不被 saved 误标(审计回归)', () => {
|
||||
const t = createTab({ content: '快照' })
|
||||
let s: TabsState = { tabs: [t], activeId: t.id }
|
||||
// 写盘用的是「快照」;await 期间用户又输入了新内容
|
||||
s = tabsReducer(s, { type: 'updateContent', id: t.id, content: '快照+新输入' })
|
||||
s = tabsReducer(s, { type: 'saved', id: t.id, savedContent: '快照' })
|
||||
expect(s.tabs[0].savedContent).toBe('快照')
|
||||
expect(isDirty(s.tabs[0])).toBe(true) // 新输入仍是脏的,等待下一次保存
|
||||
})
|
||||
|
||||
it('关闭活动标签后激活相邻标签;关闭其他/右侧范围正确', () => {
|
||||
let s = stateWith(['a', 'b', 'c'])
|
||||
const [t1, t2, t3] = s.tabs
|
||||
|
||||
Reference in New Issue
Block a user