From 74fbc715e9e41be0c191e4a4edcb820d07a142e5 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 2 Dec 2021 17:24:19 +0000 Subject: [PATCH] #1324 Fixes Bi-directional re-factor issue --- src/file/paragraph/properties.spec.ts | 26 ++++++++++++++++++++++++++ src/file/paragraph/properties.ts | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/file/paragraph/properties.spec.ts b/src/file/paragraph/properties.spec.ts index e8961ceea6..8779b49e4c 100644 --- a/src/file/paragraph/properties.spec.ts +++ b/src/file/paragraph/properties.spec.ts @@ -91,5 +91,31 @@ describe("ParagraphProperties", () => { ], }); }); + + it("should create with bidirectional", () => { + 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: {} }), + }); + + expect(tree).to.deep.equal({ + "w:pPr": [ + { + "w:bidi": {}, + }, + ], + }); + }); }); }); diff --git a/src/file/paragraph/properties.ts b/src/file/paragraph/properties.ts index 8b09819233..fd1e18c826 100644 --- a/src/file/paragraph/properties.ts +++ b/src/file/paragraph/properties.ts @@ -146,7 +146,7 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent { } if (options.bidirectional !== undefined) { - this.push(new OnOffElement("w:bidi", options.contextualSpacing)); + this.push(new OnOffElement("w:bidi", options.bidirectional)); } if (options.spacing) {