@@ -254,4 +254,54 @@ describe("OpenDocument normalized models", () => {
|
||||
expect(document.format).toBe("odt");
|
||||
expect(document.warnings).toContain("Package has no META-INF/manifest.xml");
|
||||
});
|
||||
|
||||
it("retains page geometry, default styles, comments and spreadsheet column metadata", () => {
|
||||
const styles = `<?xml version="1.0"?><office:document-styles ${XMLNS}>
|
||||
<office:styles><style:default-style style:family="paragraph"><style:text-properties fo:color="#123456"/></style:default-style></office:styles>
|
||||
<office:automatic-styles><style:page-layout style:name="pm1"><style:page-layout-properties fo:page-width="21cm" fo:page-height="29.7cm"/></style:page-layout></office:automatic-styles>
|
||||
</office:document-styles>`;
|
||||
const odt = parseOdt(
|
||||
makeOdf(
|
||||
"odt",
|
||||
odtContent(
|
||||
`<text:p>Reviewed<office:annotation office:name="c1"><dc:creator>Ada</dc:creator><dc:date>2026-09-01</dc:date><text:p>Looks good</text:p></office:annotation></text:p>`,
|
||||
),
|
||||
{ styles },
|
||||
),
|
||||
);
|
||||
expect(odt.pageWidth).toMatchObject({ value: 21, unit: "cm" });
|
||||
expect(odt.styles).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ isDefault: true, family: "paragraph" }),
|
||||
]),
|
||||
);
|
||||
expect(odt.annotations[0]).toMatchObject({
|
||||
id: "c1",
|
||||
creator: "Ada",
|
||||
createdAt: "2026-09-01",
|
||||
blocks: [expect.objectContaining({ text: "Looks good" })],
|
||||
});
|
||||
|
||||
const ods = parseOds(
|
||||
makeOdf(
|
||||
"ods",
|
||||
odsContent(`<table:table table:name="Columns" table:visibility="collapse">
|
||||
<table:table-column table:number-columns-repeated="3" table:style-name="Wide" table:default-cell-style-name="Money"/>
|
||||
<table:table-row table:default-cell-style-name="RowDefault"><table:table-cell office:value-type="string"><text:p>x</text:p></table:table-cell></table:table-row>
|
||||
</table:table>`),
|
||||
),
|
||||
);
|
||||
expect(ods.sheets[0]).toMatchObject({
|
||||
visibility: "collapse",
|
||||
columns: [
|
||||
{
|
||||
index: 0,
|
||||
repeat: 3,
|
||||
styleName: "Wide",
|
||||
defaultCellStyleName: "Money",
|
||||
},
|
||||
],
|
||||
rows: [expect.objectContaining({ defaultCellStyleName: "RowDefault" })],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user