2017-03-07 22:15:53 +00:00
|
|
|
import { assert } from "chai";
|
2017-03-09 22:31:55 +00:00
|
|
|
import { PageBreak } from "../../../docx/paragraph/page-break";
|
|
|
|
import { Utility } from "../../utility";
|
2016-07-17 16:18:20 +01:00
|
|
|
|
|
|
|
describe("PageBreak", () => {
|
|
|
|
let pageBreak: PageBreak;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
pageBreak = new PageBreak();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#constructor()", () => {
|
2016-07-18 19:17:19 +01:00
|
|
|
it("should create a Page Break with correct attributes", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(pageBreak);
|
|
|
|
const attributes = {
|
|
|
|
type: "page",
|
2016-07-17 16:18:20 +01:00
|
|
|
};
|
|
|
|
assert.equal(JSON.stringify(newJson.root[1].root[0].root), JSON.stringify(attributes));
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create a Page Break with w:r", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(pageBreak);
|
2016-07-17 16:18:20 +01:00
|
|
|
assert.equal(newJson.rootKey, "w:r");
|
|
|
|
});
|
2017-03-07 22:15:53 +00:00
|
|
|
|
2016-07-17 16:18:20 +01:00
|
|
|
it("should create a Page Break with a Break inside", () => {
|
2017-03-09 22:31:55 +00:00
|
|
|
const newJson = Utility.jsonify(pageBreak);
|
2016-07-17 16:18:20 +01:00
|
|
|
assert.equal(newJson.root[1].rootKey, "w:br");
|
|
|
|
});
|
|
|
|
});
|
2017-03-09 22:31:55 +00:00
|
|
|
});
|