From c3c29bb119f0d5ac3cc3569ef511ca8ca1e4cb6b Mon Sep 17 00:00:00 2001 From: Maximilian Zauner Date: Fri, 18 Oct 2019 14:09:33 +0200 Subject: [PATCH] fix(test): added unit test for TextRun --- src/file/paragraph/run/text-run.spec.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/file/paragraph/run/text-run.spec.ts b/src/file/paragraph/run/text-run.spec.ts index 077d6300f0..ae8e5bd9b4 100644 --- a/src/file/paragraph/run/text-run.spec.ts +++ b/src/file/paragraph/run/text-run.spec.ts @@ -16,4 +16,23 @@ describe("TextRun", () => { }); }); }); + + describe("#referenceFootnote()", () => { + it("should add a valid footnote reference", () => { + run = new TextRun("test"); + run.referenceFootnote(1); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [ + { "w:t": [{ _attr: { "xml:space": "preserve" } }, "test"] }, + { + "w:r": [ + { "w:rPr": [{ "w:rStyle": { _attr: { "w:val": "FootnoteReference" } } }] }, + { "w:footnoteReference": { _attr: { "w:id": 1 } } }, + ], + }, + ], + }); + }); + }); });