Import QWord DOCX lists from numbering
This commit is contained in:
@@ -225,6 +225,39 @@ describe("wordOffice DOCX import", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX bullet and numbered lists from OOXML numbering", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"Lists.docx",
|
||||
'<ul><li>Bullet <strong>one</strong></li><li><span style="color: #0f5fae;">Bullet two</span></li></ul><ol><li>Step one</li><li>Step two</li></ol>'
|
||||
);
|
||||
const file = new File([blob], "Lists.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain("<ul>");
|
||||
expect(imported.html).toContain("<ol>");
|
||||
expect(imported.html).toContain("color: #0F5FAE;");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{
|
||||
type: "list",
|
||||
ordered: false,
|
||||
items: [
|
||||
{ text: "Bullet one", runs: [{ text: "Bullet " }, { text: "one", bold: true }] },
|
||||
{ text: "Bullet two", runs: [{ text: "Bullet two", color: "0F5FAE" }] }
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "list",
|
||||
ordered: true,
|
||||
items: [
|
||||
{ text: "Step one", runs: [{ text: "Step one" }] },
|
||||
{ text: "Step two", runs: [{ text: "Step two" }] }
|
||||
]
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports styled DOCX content when the document also contains images", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"Mixed.docx",
|
||||
|
||||
Reference in New Issue
Block a user