Add tests

This commit is contained in:
Dolan
2018-11-01 02:22:32 +00:00
parent a84eb16392
commit 61411fd0f3
16 changed files with 673 additions and 223 deletions

View File

@ -2,7 +2,7 @@ import { expect } from "chai";
import { Formatter } from "export/formatter";
import { Spacing } from "./spacing";
import { ContextualSpacing, Spacing } from "./spacing";
describe("Spacing", () => {
describe("#constructor", () => {
@ -23,3 +23,23 @@ describe("Spacing", () => {
});
});
});
describe("ContextualSpacing", () => {
describe("#constructor", () => {
it("should create", () => {
const spacing = new ContextualSpacing(true);
const tree = new Formatter().format(spacing);
expect(tree).to.deep.equal({
"w:contextualSpacing": [{ _attr: { "w:val": 1 } }],
});
});
it("should create with value of 0 if param is false", () => {
const spacing = new ContextualSpacing(false);
const tree = new Formatter().format(spacing);
expect(tree).to.deep.equal({
"w:contextualSpacing": [{ _attr: { "w:val": 0 } }],
});
});
});
});