From 5ad7fd8a15cac50eae6836a6249742d2da60440a Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 2 Dec 2021 17:27:00 +0000 Subject: [PATCH] Add more tests --- src/file/paragraph/properties.spec.ts | 58 +++++++++++++++------------ 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/src/file/paragraph/properties.spec.ts b/src/file/paragraph/properties.spec.ts index 8779b49e4c..dbf2021e8a 100644 --- a/src/file/paragraph/properties.spec.ts +++ b/src/file/paragraph/properties.spec.ts @@ -70,18 +70,7 @@ describe("ParagraphProperties", () => { const properties = new ParagraphProperties({ widowControl: true, }); - const tree = new Formatter().format(properties, { - // tslint:disable-next-line: no-object-literal-type-assertion - file: { - Numbering: { - createConcreteNumberingInstance: (_: string, __: number) => { - return; - }, - }, - } as File, - // tslint:disable-next-line: no-object-literal-type-assertion - viewWrapper: new DocumentWrapper({ background: {} }), - }); + const tree = new Formatter().format(properties); expect(tree).to.deep.equal({ "w:pPr": [ @@ -92,22 +81,11 @@ describe("ParagraphProperties", () => { }); }); - it("should create with bidirectional", () => { + it("should create with the bidirectional property", () => { const properties = new ParagraphProperties({ bidirectional: true, }); - const tree = new Formatter().format(properties, { - // tslint:disable-next-line: no-object-literal-type-assertion - file: { - Numbering: { - createConcreteNumberingInstance: (_: string, __: number) => { - return; - }, - }, - } as File, - // tslint:disable-next-line: no-object-literal-type-assertion - viewWrapper: new DocumentWrapper({ background: {} }), - }); + const tree = new Formatter().format(properties); expect(tree).to.deep.equal({ "w:pPr": [ @@ -117,5 +95,35 @@ describe("ParagraphProperties", () => { ], }); }); + + it("should create with the contextualSpacing property", () => { + const properties = new ParagraphProperties({ + contextualSpacing: true, + }); + const tree = new Formatter().format(properties); + + expect(tree).to.deep.equal({ + "w:pPr": [ + { + "w:contextualSpacing": {}, + }, + ], + }); + }); + + it("should create with the suppressLineNumbers property", () => { + const properties = new ParagraphProperties({ + suppressLineNumbers: true, + }); + const tree = new Formatter().format(properties); + + expect(tree).to.deep.equal({ + "w:pPr": [ + { + "w:suppressLineNumbers": {}, + }, + ], + }); + }); }); });