From 6689f76c2809373f73c84c968b16302c6aadb758 Mon Sep 17 00:00:00 2001 From: felipe Date: Sun, 12 Mar 2017 21:58:12 +0100 Subject: [PATCH] added #thematicBreak method to paragraph styles --- ts/styles/style/index.ts | 5 +++++ ts/tests/stylesTest.ts | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ts/styles/style/index.ts b/ts/styles/style/index.ts index 41493c9188..35e456d937 100644 --- a/ts/styles/style/index.ts +++ b/ts/styles/style/index.ts @@ -156,6 +156,11 @@ export class ParagraphStyle extends Style { return this; } + public thematicBreak(): ParagraphStyle { + this.addParagraphProperty(new paragraph.ThematicBreak()); + return this; + } + public indent(left: number, hanging?: number): ParagraphStyle { this.addParagraphProperty(new paragraph.Indent(left, hanging)); return this; diff --git a/ts/tests/stylesTest.ts b/ts/tests/stylesTest.ts index 68eeb6915d..821ff2a9f3 100644 --- a/ts/tests/stylesTest.ts +++ b/ts/tests/stylesTest.ts @@ -272,6 +272,26 @@ describe("ParagraphStyle", () => { ], }); }); + + it("#thematicBreak", () => { + const style = new ParagraphStyle("myStyleId") + .thematicBreak(); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + {_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}}, + {"w:pPr": [ + {"w:pBdr": [{"w:bottom": [{_attr: { + "w:color": "auto", + "w:space": "1", + "w:val": "single", + "w:sz": "6", + }}]}]}, + ]}, + {"w:rPr": []}, + ], + }); + }); }); describe("formatting methods: run properties", () => {