wrote tab stop tests

This commit is contained in:
Dolan Miu
2016-07-15 18:50:54 +01:00
parent 8752c63345
commit f8cf0431c0
4 changed files with 77 additions and 20 deletions

View File

@ -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");
});
});
});

View File

@ -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", () => {

View File

@ -1,7 +1,4 @@
/// <reference path="../../../../typings/mocha/mocha.d.ts" />
/// <reference path="../../../../typings/chai/chai.d.ts" />
import {Attributes} from "../../../../docx/xml-components";
import {Attributes} from "../../../docx/xml-components";
import {assert} from "chai";
describe("Attribute", () => {