项目文件夹

文件
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +08:00

24 行
1.0 KiB
TypeScript

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
import { describe, it, expect } from 'vitest';
import { renderTxBodyHtml } from './helpers';
/**
* 回归(auto-fix.md 坑表):空段(占位空行)的填充与高度。
*
* 现象①(a2m):用 `<p><br/></p>` 撑高度的空段,在 ProseMirror 里 hard_break 结尾
* 会再补一个 trailingBreak → `<br><br>` = 2 行,累积把下方图标/正文整体压下去错位。
* 修复:空段填充改用 `&nbsp;`raw-HTML 与 ProseMirror 两端都恰好 1 行)。
* 现象②:空 `<p>` 高度为 0(没有内联盒),需要按 endParaRPr 的字号撑出空行高度。
*/
describe('textSerializer · 空段填充', () => {
const html = renderTxBodyHtml(`<a:p><a:endParaRPr sz="3600"/></a:p>`);
it('空段用 &nbsp; 填充,而不是 <br/>(避免 a2m 里被加倍成两行)', () => {
expect(html).toContain('&nbsp;');
expect(html).not.toContain('<br');
});
it('空段按 endParaRPr 字号撑出行高(sz=3600 → 36pt', () => {
expect(html).toContain('font-size: 36pt');
});
});