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

@ -1,10 +1,6 @@
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);
}
import { LeftTabStop, MaxRightTabStop } from "../../../docx/paragraph/tab-stop";
import { Utility } from "../../utility";
describe("LeftTabStop", () => {
let tabStop: LeftTabStop;
@ -15,23 +11,23 @@ describe("LeftTabStop", () => {
describe("#constructor()", () => {
it("should create a Tab Stop with correct attributes", () => {
let newJson = jsonify(tabStop);
let attributes = {
const newJson = Utility.jsonify(tabStop);
const attributes = {
val: "left",
pos: 100
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);
const newJson = Utility.jsonify(tabStop);
assert.equal(newJson.root[0].rootKey, "w:tab");
});
});
});
describe("RightTabStop", () => {
// TODO
});
describe("MaxRightTabStop", () => {
@ -43,18 +39,18 @@ describe("MaxRightTabStop", () => {
describe("#constructor()", () => {
it("should create a Tab Stop with correct attributes", () => {
let newJson = jsonify(tabStop);
const newJson = Utility.jsonify(tabStop);
let attributes = {
const attributes = {
val: "right",
pos: 9026
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);
const newJson = Utility.jsonify(tabStop);
assert.equal(newJson.root[0].rootKey, "w:tab");
});
});
});
});

View File

@ -27,4 +27,4 @@ describe("NumberProperties", () => {
assert.equal(newJson.root[1].root[0].root.val, 5);
});
});
});
});