2017-03-07 22:15:53 +00:00
|
|
|
import { assert } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
|
|
|
import { Utility } from "../../tests/utility";
|
|
|
|
import { LeftTabStop, MaxRightTabStop } from "./tab-stop";
|
2016-07-15 18:50:54 +01:00
|
|
|
|
|
|
|
describe("LeftTabStop", () => {
|
|
|
|
let tabStop: LeftTabStop;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
tabStop = new LeftTabStop(100);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create a Tab Stop with correct attributes", () => {
|
2017-03-09 22:56:08 +00:00
|
|
|
const newJson = Utility.jsonify(tabStop);
|
|
|
|
const attributes = {
|
2016-07-15 18:50:54 +01:00
|
|
|
val: "left",
|
2017-03-09 22:56:08 +00:00
|
|
|
pos: 100,
|
2016-07-15 18:50:54 +01:00
|
|
|
};
|
|
|
|
assert.equal(JSON.stringify(newJson.root[0].root[0].root), JSON.stringify(attributes));
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create a Tab Stop with w:tab", () => {
|
2017-03-09 22:56:08 +00:00
|
|
|
const newJson = Utility.jsonify(tabStop);
|
2016-07-15 18:50:54 +01:00
|
|
|
assert.equal(newJson.root[0].rootKey, "w:tab");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("RightTabStop", () => {
|
2017-03-09 22:56:08 +00:00
|
|
|
// TODO
|
2016-07-15 18:50:54 +01:00
|
|
|
});
|
|
|
|
|
2016-07-17 16:03:31 +01:00
|
|
|
describe("MaxRightTabStop", () => {
|
2016-07-15 18:50:54 +01:00
|
|
|
let tabStop: MaxRightTabStop;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
tabStop = new MaxRightTabStop();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create a Tab Stop with correct attributes", () => {
|
2017-03-09 22:56:08 +00:00
|
|
|
const newJson = Utility.jsonify(tabStop);
|
2016-07-15 18:50:54 +01:00
|
|
|
|
2017-03-09 22:56:08 +00:00
|
|
|
const attributes = {
|
2016-07-15 18:50:54 +01:00
|
|
|
val: "right",
|
2017-03-09 22:56:08 +00:00
|
|
|
pos: 9026,
|
2016-07-15 18:50:54 +01:00
|
|
|
};
|
|
|
|
assert.equal(JSON.stringify(newJson.root[0].root[0].root), JSON.stringify(attributes));
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create a Tab Stop with w:tab", () => {
|
2017-03-09 22:56:08 +00:00
|
|
|
const newJson = Utility.jsonify(tabStop);
|
2016-07-15 18:50:54 +01:00
|
|
|
assert.equal(newJson.root[0].rootKey, "w:tab");
|
|
|
|
});
|
|
|
|
});
|
2017-03-09 22:56:08 +00:00
|
|
|
});
|