Align A2 IM preview with character-only frames (B-style H1, fullwidth table lines), refine shell/titlebar styling, and document the theme rules. Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { renderEmojiMarkdown } from '../renderer/lib/emojiMarkdown';
|
|
|
|
describe('emojiMarkdown nested lists', () => {
|
|
it('keeps nested unordered items on their own indented lines', () => {
|
|
const md = `## 无序列表
|
|
|
|
- 第一项要点
|
|
- 第二项要点
|
|
- 嵌套子项 A
|
|
- 嵌套子项 B
|
|
- 第三项要点
|
|
`;
|
|
const html = renderEmojiMarkdown(md, {
|
|
appendFooter: false,
|
|
themeId: 'A2',
|
|
});
|
|
const text = html
|
|
.replace(/<br\s*\/?>/gi, '\n')
|
|
.replace(/<\/div>/gi, '\n')
|
|
.replace(/<[^>]+>/g, '');
|
|
|
|
const lines = text
|
|
.split('\n')
|
|
.map((line) => line.trimEnd())
|
|
.filter((line) => line.trim().length > 0);
|
|
|
|
const parentIdx = lines.findIndex((line) => line.includes('第二项要点'));
|
|
const childAIdx = lines.findIndex((line) => line.includes('嵌套子项 A'));
|
|
const childBIdx = lines.findIndex((line) => line.includes('嵌套子项 B'));
|
|
|
|
expect(parentIdx).toBeGreaterThanOrEqual(0);
|
|
expect(childAIdx).toBe(parentIdx + 1);
|
|
expect(childBIdx).toBe(parentIdx + 2);
|
|
expect(lines[childAIdx]).toMatch(/^ │/);
|
|
expect(lines[childBIdx]).toMatch(/^ │/);
|
|
expect(lines[parentIdx]).toMatch(/^🔹/);
|
|
});
|
|
});
|