feat: 完成 DOCX 通用结构映射与严格收口

This commit is contained in:
SkyJourney
2026-07-31 15:19:34 +08:00
parent 6e40374200
commit f3847f3e4b
31 changed files with 3175 additions and 64 deletions
@@ -178,6 +178,31 @@ describe("DOCX 主题令牌归一化", () => {
expect(tokens.slots).toHaveLength(DOCX_STYLE_SLOT_NAMES.length);
});
it("按 border-box 文档的内容区宽度归一化全宽表格", () => {
const tokens = resolveDocxThemeTokens({
snapshot: createSnapshot({
document: {
width: "790px",
paddingLeft: "30px",
paddingRight: "30px",
borderLeft: "0px none rgb(17, 34, 51)",
borderRight: "0px none rgb(17, 34, 51)"
},
table: {
width: "730px"
}
}),
config: {
mode: "auto",
basePreset: "general",
overrides: {},
legacyPreset: false
}
});
expect(findSlot(tokens, "table").style.widthPercent).toBe(100);
});
it("保留封面高度、垂直对齐、轮廓线和隐藏字段语义", () => {
const tokens = resolveDocxThemeTokens({
snapshot: createSnapshot({