From f8cf0431c0c89145e21e01f16382fd1bd317bc44 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Fri, 15 Jul 2016 18:50:54 +0100 Subject: [PATCH] wrote tab stop tests --- .../{paragraphTest.ts => paragraphTests.ts} | 0 ts/tests/docx/paragraph/tabStopTests.ts | 60 +++++++++++++++++++ ts/tests/docx/run/underlineTests.ts | 32 +++++----- ts/tests/docx/xml-components/attributeTest.ts | 5 +- 4 files changed, 77 insertions(+), 20 deletions(-) rename ts/tests/docx/paragraph/{paragraphTest.ts => paragraphTests.ts} (100%) create mode 100644 ts/tests/docx/paragraph/tabStopTests.ts diff --git a/ts/tests/docx/paragraph/paragraphTest.ts b/ts/tests/docx/paragraph/paragraphTests.ts similarity index 100% rename from ts/tests/docx/paragraph/paragraphTest.ts rename to ts/tests/docx/paragraph/paragraphTests.ts diff --git a/ts/tests/docx/paragraph/tabStopTests.ts b/ts/tests/docx/paragraph/tabStopTests.ts new file mode 100644 index 0000000000..6be4e1cc7b --- /dev/null +++ b/ts/tests/docx/paragraph/tabStopTests.ts @@ -0,0 +1,60 @@ +import {LeftTabStop, MaxRightTabStop} from "../../../docx/paragraph/tab-stop"; +import {assert} from "chai"; + +function jsonify(obj: Object) { + let stringifiedJson = JSON.stringify(obj); + return JSON.parse(stringifiedJson); +} + +describe("LeftTabStop", () => { + let tabStop: LeftTabStop; + + beforeEach(() => { + tabStop = new LeftTabStop(100); + }); + + describe("#constructor()", () => { + it("should create a Tab Stop with correct attributes", () => { + let newJson = jsonify(tabStop); + let attributes = { + val: "left", + pos: 100 + }; + assert.equal(JSON.stringify(newJson.root[0].root[0].root), JSON.stringify(attributes)); + }); + + it("should create a Tab Stop with w:tab", () => { + let newJson = jsonify(tabStop); + assert.equal(newJson.root[0].rootKey, "w:tab"); + }); + }); +}); + +describe("RightTabStop", () => { + +}); + +describe.only("MaxRightTabStop", () => { + let tabStop: MaxRightTabStop; + + beforeEach(() => { + tabStop = new MaxRightTabStop(); + }); + + describe("#constructor()", () => { + it("should create a Tab Stop with correct attributes", () => { + let newJson = jsonify(tabStop); + + let attributes = { + val: "right", + pos: 9026 + }; + assert.equal(JSON.stringify(newJson.root[0].root[0].root), JSON.stringify(attributes)); + }); + + it("should create a Tab Stop with w:tab", () => { + let newJson = jsonify(tabStop); + assert.equal(newJson.root[0].rootKey, "w:tab"); + }); + }); +}); \ No newline at end of file diff --git a/ts/tests/docx/run/underlineTests.ts b/ts/tests/docx/run/underlineTests.ts index e678390917..92d21601a7 100644 --- a/ts/tests/docx/run/underlineTests.ts +++ b/ts/tests/docx/run/underlineTests.ts @@ -19,7 +19,7 @@ describe("Underline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should have u:u as the rootKey", () => { @@ -36,7 +36,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -47,7 +47,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -58,7 +58,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -69,7 +69,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -80,7 +80,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -91,7 +91,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -102,7 +102,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -113,7 +113,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -124,7 +124,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -135,7 +135,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -146,7 +146,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -157,7 +157,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -168,7 +168,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -179,7 +179,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { @@ -190,7 +190,7 @@ describe.only("DashDotDotHeavyUnderline", () => { }); }); -describe.only("DashDotDotHeavyUnderline", () => { +describe("DashDotDotHeavyUnderline", () => { describe("#constructor()", () => { it("should put value in attribute", () => { diff --git a/ts/tests/docx/xml-components/attributeTest.ts b/ts/tests/docx/xml-components/attributeTest.ts index e9d23a9286..d0be2f2e71 100644 --- a/ts/tests/docx/xml-components/attributeTest.ts +++ b/ts/tests/docx/xml-components/attributeTest.ts @@ -1,7 +1,4 @@ -/// -/// - -import {Attributes} from "../../../../docx/xml-components"; +import {Attributes} from "../../../docx/xml-components"; import {assert} from "chai"; describe("Attribute", () => {