Preserve QWord strikethrough formatting
This commit is contained in:
@@ -248,6 +248,34 @@ describe("wordOffice helpers", () => {
|
||||
expect(documentXml).toContain('w:ascii="Arial"');
|
||||
});
|
||||
|
||||
it("сохраняет зачеркнутый текст из HTML для DOCX", () => {
|
||||
const blocks = htmlToWordBlocks('<p><s>Deleted</s> <span style="text-decoration-line: line-through;">Styled</span></p>');
|
||||
|
||||
expect(blocks).toEqual([
|
||||
{
|
||||
type: "paragraph",
|
||||
text: "Deleted Styled",
|
||||
runs: [
|
||||
{ text: "Deleted", strike: true },
|
||||
{ text: " " },
|
||||
{ text: "Styled", strike: true }
|
||||
]
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("преобразует зачеркнутый inline run в параметр docx strike", () => {
|
||||
expect(wordInlineRunsToTextRunOptions([{ text: "Deleted", strike: true }])).toEqual([{ text: "Deleted", strike: true }]);
|
||||
});
|
||||
|
||||
it("записывает зачеркнутый текст в XML экспортированного DOCX", async () => {
|
||||
const blob = await exportDocxBlob("Зачеркнутый.docx", "<p><s>Удаленный текст</s></p>");
|
||||
const zip = await JSZip.loadAsync(await blob.arrayBuffer());
|
||||
const documentXml = await zip.file("word/document.xml")?.async("string");
|
||||
|
||||
expect(documentXml).toContain("<w:strike/>");
|
||||
});
|
||||
|
||||
it("нормализует HTML после импорта DOCX", () => {
|
||||
expect(normalizeImportedDocxHtml(" <p>Готово</p>\n")).toBe("<p>Готово</p>");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user