Support full QWord heading hierarchy in DOCX
This commit is contained in:
@@ -5,13 +5,21 @@ const tinyPngBase64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42
|
||||
const tinyPngDataUri = `data:image/png;base64,${tinyPngBase64}`;
|
||||
|
||||
describe("wordOffice DOCX import", () => {
|
||||
it("imports DOCX Heading 3 as h3", async () => {
|
||||
const blob = await exportDocxBlob("Heading3.docx", "<h3>Quality gate</h3>");
|
||||
const file = new File([blob], "Heading3.docx", { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
||||
it("imports DOCX Heading 3-6 as h3-h6", async () => {
|
||||
const blob = await exportDocxBlob("Headings.docx", "<h3>Quality gate</h3><h4>Scenario</h4><h5>Step</h5><h6>Detail</h6>");
|
||||
const file = new File([blob], "Headings.docx", { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain("<h3>Quality gate</h3>");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([{ type: "heading", level: 3, text: "Quality gate", runs: [{ text: "Quality gate" }] }]);
|
||||
expect(imported.html).toContain("<h4>Scenario</h4>");
|
||||
expect(imported.html).toContain("<h5>Step</h5>");
|
||||
expect(imported.html).toContain("<h6>Detail</h6>");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{ type: "heading", level: 3, text: "Quality gate", runs: [{ text: "Quality gate" }] },
|
||||
{ type: "heading", level: 4, text: "Scenario", runs: [{ text: "Scenario" }] },
|
||||
{ type: "heading", level: 5, text: "Step", runs: [{ text: "Step" }] },
|
||||
{ type: "heading", level: 6, text: "Detail", runs: [{ text: "Detail" }] }
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX text color and highlight from OOXML", async () => {
|
||||
|
||||
Reference in New Issue
Block a user