This commit is contained in:
Dolan
2017-03-09 22:56:08 +00:00
parent 5fac776dca
commit 7022b39d2e
21 changed files with 138 additions and 181 deletions

View File

@ -2,10 +2,7 @@ import { assert, expect } from "chai";
import { Run } from "../../../docx/run";
import { TextRun } from "../../../docx/run/text-run";
import { Formatter } from "../../../export/formatter";
function jsonify(obj: object) {
return JSON.parse(JSON.stringify(obj));
}
import { Utility } from "../../utility";
describe("Run", () => {
let run: Run;
@ -17,7 +14,7 @@ describe("Run", () => {
describe("#bold()", () => {
it("it should add bold to the properties", () => {
run.bold();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:b");
});
});
@ -25,7 +22,7 @@ describe("Run", () => {
describe("#italic()", () => {
it("it should add italics to the properties", () => {
run.italic();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:i");
});
});
@ -33,7 +30,7 @@ describe("Run", () => {
describe("#underline()", () => {
it("it should add underline to the properties", () => {
run.underline();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:u");
});
});
@ -41,7 +38,7 @@ describe("Run", () => {
describe("#smallCaps()", () => {
it("it should add smallCaps to the properties", () => {
run.smallCaps();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:smallCaps");
});
});
@ -49,7 +46,7 @@ describe("Run", () => {
describe("#caps()", () => {
it("it should add caps to the properties", () => {
run.allCaps();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:caps");
});
});
@ -57,7 +54,7 @@ describe("Run", () => {
describe("#strike()", () => {
it("it should add strike to the properties", () => {
run.strike();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:strike");
});
});
@ -65,7 +62,7 @@ describe("Run", () => {
describe("#doubleStrike()", () => {
it("it should add caps to the properties", () => {
run.doubleStrike();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[0].root[0].rootKey, "w:dstrike");
});
});
@ -73,7 +70,7 @@ describe("Run", () => {
describe("#break()", () => {
it("it should add break to the run", () => {
run.break();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[1].rootKey, "w:br");
});
});
@ -81,7 +78,7 @@ describe("Run", () => {
describe("#tab()", () => {
it("it should add break to the run", () => {
run.tab();
const newJson = jsonify(run);
const newJson = Utility.jsonify(run);
assert.equal(newJson.root[1].rootKey, "w:tab");
});
});