feature: add support for section page borders

This commit is contained in:
Igor Bulovski
2018-07-03 13:48:31 +02:00
parent 612a2f90ac
commit 796e000826
11 changed files with 261 additions and 34 deletions

View File

@ -2,7 +2,7 @@ import { expect } from "chai";
import { Formatter } from "../../../../export/formatter";
import { SectionProperties } from "./section-properties";
import { FooterReferenceType, PageNumberFormat } from ".";
import { FooterReferenceType, PageNumberFormat, PageBorderOffsetFrom } from ".";
describe("SectionProperties", () => {
describe("#constructor()", () => {
@ -155,5 +155,18 @@ describe("SectionProperties", () => {
],
});
});
it("should create section properties with page borders", () => {
const properties = new SectionProperties({
pageBorders: {
offsetFrom: PageBorderOffsetFrom.PAGE,
},
});
const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]);
expect(tree["w:sectPr"][7]).to.deep.equal({
"w:pgBorders": [{ _attr: { "w:offsetFrom": "page" } }],
});
});
});
});