diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index a368684d40..5f4a3dabd0 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -596,6 +596,36 @@ describe("Paragraph", () => { }); }); + it("should add a style to the list paragraph when provided", () => { + const paragraph = new Paragraph({ + numbering: { + reference: "test id", + level: 0, + }, + style: "myFancyStyle", + }); + 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": "myFancyStyle" } }, + }); + }); + + it("should not add ListParagraph style to a list when using custom numbering", () => { + const paragraph = new Paragraph({ + numbering: { + reference: "test id", + level: 0, + custom: true, + }, + }); + 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.not.have.property("w:pStyle"); + }); + it("it should add numbered properties", () => { const paragraph = new Paragraph({ numbering: {