2017-03-07 22:15:53 +00:00
|
|
|
import { assert } from "chai";
|
2017-03-09 22:31:55 +00:00
|
|
|
import { Body } from "../../../docx/document/body";
|
2017-03-07 22:15:53 +00:00
|
|
|
import { Columns } from "../../../docx/document/body/columns";
|
|
|
|
import { DocumentGrid } from "../../../docx/document/body/doc-grid";
|
2017-03-09 22:31:55 +00:00
|
|
|
import { PageMargin } from "../../../docx/document/body/page-margin";
|
|
|
|
import { PageSize } from "../../../docx/document/body/page-size";
|
|
|
|
import { SectionProperties } from "../../../docx/document/body/section-properties";
|
|
|
|
import { Utility } from "../../utility";
|
2016-03-31 23:01:20 +01:00
|
|
|
|
2016-04-03 05:24:56 +01:00
|
|
|
describe("Body", () => {
|
2016-05-26 15:08:34 +01:00
|
|
|
let body: Body;
|
2016-03-31 23:01:20 +01:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
body = new Body();
|
2016-04-09 04:53:42 +01:00
|
|
|
body.push(new SectionProperties());
|
|
|
|
body.push(new PageSize());
|
|
|
|
body.push(new PageMargin());
|
|
|
|
body.push(new Columns());
|
|
|
|
body.push(new DocumentGrid());
|
2016-03-31 23:01:20 +01:00
|
|
|
});
|
|
|
|
|
2016-04-04 17:30:29 +01:00
|
|
|
describe("#constructor()", () => {
|
2016-04-01 00:22:44 +01:00
|
|
|
|
|
|
|
it("should create the Section Properties", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(body);
|
2016-05-02 22:39:03 +01:00
|
|
|
assert.equal(newJson.root[0].rootKey, "w:sectPr");
|
2016-04-01 00:22:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should create the Page Size", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(body);
|
2016-05-02 22:39:03 +01:00
|
|
|
assert.equal(newJson.root[1].rootKey, "w:pgSz");
|
2016-04-01 00:22:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should create the Page Margin", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(body);
|
2016-05-02 22:39:03 +01:00
|
|
|
assert.equal(newJson.root[2].rootKey, "w:pgMar");
|
2016-04-01 00:22:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should create the Columns", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(body);
|
2016-05-02 22:39:03 +01:00
|
|
|
assert.equal(newJson.root[3].rootKey, "w:cols");
|
2016-04-01 00:22:44 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should create the Document Grid", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(body);
|
2016-05-02 22:39:03 +01:00
|
|
|
assert.equal(newJson.root[4].rootKey, "w:docGrid");
|
2016-03-31 23:36:42 +01:00
|
|
|
});
|
2016-03-31 23:01:20 +01:00
|
|
|
});
|
2017-03-09 22:31:55 +00:00
|
|
|
});
|