Import QWord DOCX paragraph alignment
This commit is contained in:
@@ -20,4 +20,24 @@ describe("wordOffice DOCX import", () => {
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX paragraph alignment from OOXML", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"Alignment.docx",
|
||||
'<p style="text-align: center;">Centered</p><p align="right">Right</p><p style="text-align: justify;">Justified</p>'
|
||||
);
|
||||
const file = new File([blob], "Alignment.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain('style="text-align: center;"');
|
||||
expect(imported.html).toContain('style="text-align: right;"');
|
||||
expect(imported.html).toContain('style="text-align: justify;"');
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{ type: "paragraph", text: "Centered", runs: [{ text: "Centered" }], alignment: "center" },
|
||||
{ type: "paragraph", text: "Right", runs: [{ text: "Right" }], alignment: "right" },
|
||||
{ type: "paragraph", text: "Justified", runs: [{ text: "Justified" }], alignment: "both" }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user