page break tests

This commit is contained in:
Dolan Miu
2016-07-17 16:18:20 +01:00
parent 016cffd66c
commit f4bc0613a6
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,35 @@
import {PageBreak} from "../../../docx/paragraph/page-break";
import {assert} from "chai";
function jsonify(obj: Object) {
let stringifiedJson = JSON.stringify(obj);
return JSON.parse(stringifiedJson);
}
describe("PageBreak", () => {
let pageBreak: PageBreak;
beforeEach(() => {
pageBreak = new PageBreak();
});
describe("#constructor()", () => {
it("should create a Tab Stop with correct attributes", () => {
let newJson = jsonify(pageBreak);
let attributes = {
type: "page"
};
assert.equal(JSON.stringify(newJson.root[1].root[0].root), JSON.stringify(attributes));
});
it("should create a Page Break with w:r", () => {
let newJson = jsonify(pageBreak);
assert.equal(newJson.rootKey, "w:r");
});
it("should create a Page Break with a Break inside", () => {
let newJson = jsonify(pageBreak);
assert.equal(newJson.root[1].rootKey, "w:br");
});
});
});

View File

@ -10,7 +10,7 @@ class TestComponent extends XmlComponent {
} }
describe.only("XmlComponent", () => { describe("XmlComponent", () => {
let xmlComponent: TestComponent; let xmlComponent: TestComponent;
beforeEach(() => { beforeEach(() => {