diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index e63f3160492..bd36211295a 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -162,6 +162,22 @@ describe("Paragraph", () => { }); describe("#bullet()", () => { + it("should default to 0 indent level if no bullet was specified", () => { + paragraph.bullet(); + const tree = new Formatter().format(paragraph); + expect(tree) + .to.have.property("w:p") + .which.is.an("array") + .which.has.length.at.least(1); + expect(tree["w:p"][0]) + .to.have.property("w:pPr") + .which.is.an("array") + .which.has.length.at.least(1); + expect(tree["w:p"][0]["w:pPr"][0]).to.deep.equal({ + "w:pStyle": [{ _attr: { "w:val": "ListParagraph" } }], + }); + }); + it("should add list paragraph style to JSON", () => { paragraph.bullet(0); const tree = new Formatter().format(paragraph); diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index e0ed98b84e1..2c5e007a9b6 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -129,8 +129,7 @@ export class Paragraph extends XmlComponent { return this; } - public bullet(indentLevel: number): Paragraph { - indentLevel = indentLevel || 0; + public bullet(indentLevel: number = 0): Paragraph { this.properties.push(new Style("ListParagraph")); this.properties.push(new NumberProperties(1, indentLevel)); return this;