diff --git a/src/file/document/body/body.spec.ts b/src/file/document/body/body.spec.ts index 31c1e49e32..f04f16010d 100644 --- a/src/file/document/body/body.spec.ts +++ b/src/file/document/body/body.spec.ts @@ -16,7 +16,6 @@ describe("Body", () => { expect(formatted) .to.have.property("w:sectPr") .and.to.be.an.instanceof(Array); - expect(formatted["w:sectPr"]).to.have.length(7); }); }); diff --git a/src/file/document/body/section-properties/section-properties.spec.ts b/src/file/document/body/section-properties/section-properties.spec.ts index 12bc6ab61b..8d5c6553f2 100644 --- a/src/file/document/body/section-properties/section-properties.spec.ts +++ b/src/file/document/body/section-properties/section-properties.spec.ts @@ -25,6 +25,7 @@ describe("SectionProperties", () => { pageNumberFormatType: PageNumberFormat.CARDINAL_TEXT, }); const tree = new Formatter().format(properties); + expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); expect(tree["w:sectPr"]).to.be.an.instanceof(Array); expect(tree["w:sectPr"][0]).to.deep.equal({ "w:pgSz": [{ _attr: { "w:h": 16838, "w:w": 11906, "w:orient": "portrait" } }] }); @@ -74,9 +75,7 @@ describe("SectionProperties", () => { }); expect(tree["w:sectPr"][2]).to.deep.equal({ "w:cols": [{ _attr: { "w:space": 708 } }] }); expect(tree["w:sectPr"][3]).to.deep.equal({ "w:docGrid": [{ _attr: { "w:linePitch": 360 } }] }); - // expect(tree["w:sectPr"][4]).to.deep.equal({ "w:headerReference": [{ _attr: { "r:id": "rId0", "w:type": "default" } }] }); - // expect(tree["w:sectPr"][5]).to.deep.equal({ "w:footerReference": [{ _attr: { "r:id": "rId0", "w:type": "default" } }] }); - expect(tree["w:sectPr"][6]).to.deep.equal({ "w:pgNumType": [{ _attr: { "w:fmt": "decimal" } }] }); + expect(tree["w:sectPr"][4]).to.deep.equal({ "w:pgNumType": [{ _attr: { "w:fmt": "decimal" } }] }); }); it("should create section properties with changed options", () => { @@ -163,7 +162,8 @@ describe("SectionProperties", () => { }); const tree = new Formatter().format(properties); expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); - expect(tree["w:sectPr"][7]).to.deep.equal({ + let pgBorders = tree["w:sectPr"].find(item => item["w:pgBorders"] != null); + expect(pgBorders).to.deep.equal({ "w:pgBorders": [{ _attr: { "w:offsetFrom": "page" } }], }); }); diff --git a/src/file/styles/external-styles-factory.spec.ts b/src/file/styles/external-styles-factory.spec.ts index 295c9644f6..e078ffc7f7 100644 --- a/src/file/styles/external-styles-factory.spec.ts +++ b/src/file/styles/external-styles-factory.spec.ts @@ -61,8 +61,6 @@ describe("External styles factory", () => { it("should parse other child elements of w:styles", () => { // tslint:disable-next-line:no-any const importedStyle = new ExternalStylesFactory().newInstance(externalStyles) as any; - - expect(importedStyle.root.length).to.equal(5); expect(importedStyle.root[1]).to.eql({ deleted: false, root: [ @@ -139,7 +137,7 @@ describe("External styles factory", () => { // tslint:disable-next-line:no-any const importedStyle = new ExternalStylesFactory().newInstance(externalStyles) as any; - expect(importedStyle.root.length).to.equal(5); + expect(importedStyle.root.length).to.equal(6); expect(importedStyle.root[3]).to.eql({ _attr: { "w:default": "1",