diff --git a/ts/docx/paragraph/index.ts b/ts/docx/paragraph/index.ts index 064226f0e6..9a6e27dcf9 100644 --- a/ts/docx/paragraph/index.ts +++ b/ts/docx/paragraph/index.ts @@ -106,7 +106,7 @@ export class Paragraph extends XmlComponent { bullet(): Paragraph { this.properties.push(new Style("ListParagraph")); - this.properties.push(new NumberProperties()); + this.properties.push(new NumberProperties(1, 0)); return this; } } \ No newline at end of file diff --git a/ts/docx/paragraph/unordered-list.ts b/ts/docx/paragraph/unordered-list.ts index ec270cd899..9a6611b273 100644 --- a/ts/docx/paragraph/unordered-list.ts +++ b/ts/docx/paragraph/unordered-list.ts @@ -3,10 +3,10 @@ import {Style} from "./style"; export class NumberProperties extends XmlComponent { - constructor() { + constructor(numberId: number, indentLevel: number) { super("w:numPr"); - this.root.push(new IndentLevel(0)); - this.root.push(new NumberId(1)); + this.root.push(new IndentLevel(indentLevel)); + this.root.push(new NumberId(numberId)); } } diff --git a/ts/tests/docx/paragraph/unorderedListTests.ts b/ts/tests/docx/paragraph/unorderedListTests.ts index 6a94ee4d6c..ab1b14f474 100644 --- a/ts/tests/docx/paragraph/unorderedListTests.ts +++ b/ts/tests/docx/paragraph/unorderedListTests.ts @@ -10,7 +10,7 @@ describe("NumberProperties", () => { let numberProperties: NumberProperties; beforeEach(() => { - numberProperties = new NumberProperties(); + numberProperties = new NumberProperties(5, 10); }); describe("#constructor()", () => { @@ -22,11 +22,13 @@ describe("NumberProperties", () => { it("should create a Page Break with a Indent Level inside", () => { let newJson = jsonify(numberProperties); assert.equal(newJson.root[0].rootKey, "w:ilvl"); + assert.equal(newJson.root[0].root[0].root.val, 10); }); it("should create a Page Break with a Number Id inside", () => { let newJson = jsonify(numberProperties); assert.equal(newJson.root[1].rootKey, "w:numId"); + assert.equal(newJson.root[1].root[0].root.val, 5); }); }); }); \ No newline at end of file