feat: v0.4.2 — 审查清偿:8 项修复 + setOutline API + 871 测试

修复:插件面板实例级 i18n / undo-redo 滚动保持 / shortcutHelp 卸载残留 / CSS.escape 环境崩溃 / 大纲光标按源码行号定位 / setLocale 即时刷新 / 浮动工具栏 CJK 宽度 / ko 语言包括号

新增:setOutline(isOutline) 运行时大纲 API、getRenderCacheSize 观测接口

测试:841 → 871(补 7 个事件断言、5 个配置项、修 3 处恒真断言)

工程:CI lint 阻断、build.sh npm ci、rollup 死代码清理、覆盖率阈值门禁
This commit is contained in:
2026-08-19 22:30:52 +08:00
parent 5966ac7500
commit 5f4915222e
22 changed files with 704 additions and 107 deletions
+9 -6
View File
@@ -29,7 +29,7 @@ describe('index.ts - 全局 API', () => {
test('VERSION 是字符串', () => {
expect(typeof VERSION).toBe('string');
expect(VERSION).toBe('0.4.1');
expect(VERSION).toBe('0.4.2');
});
test('api.default 是 api 本身', () => {
@@ -193,14 +193,17 @@ describe('index.ts - 解析器导出', () => {
});
test('registerBlockHandler 注册自定义块', () => {
let matched = false;
registerBlockHandler({
name: 'testBlock',
name: 'testBlockIndex',
priority: 50,
test: () => null,
parse: (_l, i) => ({ token: null, newIndex: i }),
test: (line) => { if (line === '!!!custom!!!') { matched = true; return true; } return null; },
parse: (_l, i) => ({ token: { type: 'testBlockIndex', content: 'hit' }, newIndex: i + 1 }),
});
// 不抛错即通过
expect(true).toBe(true);
const html = parseMarkdown('!!!custom!!!\nafter');
// 自定义 handler 被真实命中并产出 token(回退渲染为 me-block-* div
expect(matched).toBe(true);
expect(html).toContain('me-block-testBlockIndex');
});
});