From f4bc0613a6fa0eb1e9c754a286a02c1dd79c42e3 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 17 Jul 2016 16:18:20 +0100 Subject: [PATCH] page break tests --- ts/tests/docx/paragraph/pageBreakTests.ts | 35 +++++++++++++++++++ .../docx/xml-components/xmlComponentTests.ts | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 ts/tests/docx/paragraph/pageBreakTests.ts diff --git a/ts/tests/docx/paragraph/pageBreakTests.ts b/ts/tests/docx/paragraph/pageBreakTests.ts new file mode 100644 index 0000000000..bf6ea35acf --- /dev/null +++ b/ts/tests/docx/paragraph/pageBreakTests.ts @@ -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"); + }); + }); +}); \ No newline at end of file diff --git a/ts/tests/docx/xml-components/xmlComponentTests.ts b/ts/tests/docx/xml-components/xmlComponentTests.ts index c3980554a0..2e8fc57215 100644 --- a/ts/tests/docx/xml-components/xmlComponentTests.ts +++ b/ts/tests/docx/xml-components/xmlComponentTests.ts @@ -10,7 +10,7 @@ class TestComponent extends XmlComponent { } -describe.only("XmlComponent", () => { +describe("XmlComponent", () => { let xmlComponent: TestComponent; beforeEach(() => {