page break tests
This commit is contained in:
35
ts/tests/docx/paragraph/pageBreakTests.ts
Normal file
35
ts/tests/docx/paragraph/pageBreakTests.ts
Normal 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");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -10,7 +10,7 @@ class TestComponent extends XmlComponent {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe.only("XmlComponent", () => {
|
describe("XmlComponent", () => {
|
||||||
let xmlComponent: TestComponent;
|
let xmlComponent: TestComponent;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
Reference in New Issue
Block a user