From b81c3875a349d9e46be460b323153af8dd81176b Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Wed, 30 Mar 2016 03:58:53 +0100 Subject: [PATCH] added run tests --- ts/docx/index.ts | 1 + ts/tests/paragraphTest.ts | 10 +++++----- ts/tests/runTest.ts | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 ts/tests/runTest.ts diff --git a/ts/docx/index.ts b/ts/docx/index.ts index 81db8b1218..8fd51cddd3 100644 --- a/ts/docx/index.ts +++ b/ts/docx/index.ts @@ -1,2 +1,3 @@ export {Document} from "./document"; export {Paragraph} from "./paragraph"; +export {Run} from "./run" \ No newline at end of file diff --git a/ts/tests/paragraphTest.ts b/ts/tests/paragraphTest.ts index 13d585ed14..701b260012 100644 --- a/ts/tests/paragraphTest.ts +++ b/ts/tests/paragraphTest.ts @@ -3,6 +3,11 @@ import * as docx from "../docx"; import {assert} from "chai"; +function jsonify(obj: Object) { + var stringifiedJson = JSON.stringify(obj); + return JSON.parse(stringifiedJson); +} + describe('Paragraph', () => { var paragraph: docx.Paragraph; @@ -10,11 +15,6 @@ describe('Paragraph', () => { paragraph = new docx.Paragraph(); }); - function jsonify(obj: Object) { - var stringifiedJson = JSON.stringify(obj); - return JSON.parse(stringifiedJson); - } - describe('#constructor()', () => { it("should create valid JSON", () => { diff --git a/ts/tests/runTest.ts b/ts/tests/runTest.ts new file mode 100644 index 0000000000..e30eeb5e52 --- /dev/null +++ b/ts/tests/runTest.ts @@ -0,0 +1,38 @@ +/// +/// +import {Run} from "../docx/run"; +import {TextRun} from "../docx//run/text-run" +import {assert} from "chai"; + +function jsonify(obj: Object) { + var stringifiedJson = JSON.stringify(obj); + return JSON.parse(stringifiedJson); +} + +describe('Run', () => { + var run: Run; + + beforeEach(() => { + run = new Run(); + }); + + describe('#constructor()', () => { + + it("", () => { + + }); + }); +}); + +describe('TextRun', () => { + var run: TextRun; + + describe('#constructor()', () => { + + it("should add text into run", () => { + run = new TextRun("test"); + var newJson = jsonify(run); + assert(newJson.r[1].t === "test"); + }); + }); +}); \ No newline at end of file