Files
docx-js/src/file/paragraph/formatting/border.spec.ts

42 lines
1.1 KiB
TypeScript
Raw Normal View History

import { assert } from "chai";
2018-10-26 01:04:07 +01:00
import { Utility } from "tests/utility";
import { ThematicBreak } from "./border";
2016-03-29 04:50:23 +01:00
describe("Border", () => {
2017-03-09 22:31:55 +00:00
// TODO: Need tests here
2016-03-29 04:50:23 +01:00
});
describe("ThematicBreak", () => {
2016-05-26 15:08:34 +01:00
let thematicBreak: ThematicBreak;
2016-03-29 04:50:23 +01:00
beforeEach(() => {
thematicBreak = new ThematicBreak();
});
describe("#constructor()", () => {
2017-09-30 18:00:06 +01:00
it("should create valid JSON", () => {
const stringifiedJson = JSON.stringify(thematicBreak);
try {
2018-01-31 23:24:55 +00:00
JSON.parse(stringifiedJson);
2017-09-30 18:00:06 +01:00
} catch (e) {
assert.isTrue(false);
}
assert.isTrue(true);
});
2016-03-29 04:50:23 +01:00
it("should create a Thematic Break with correct border properties", () => {
2017-03-09 22:31:55 +00:00
const newJson = Utility.jsonify(thematicBreak);
const attributes = {
2016-03-29 04:50:23 +01:00
color: "auto",
space: "1",
val: "single",
2017-03-09 22:31:55 +00:00
sz: "6",
2016-03-29 04:50:23 +01:00
};
2016-05-02 22:39:03 +01:00
assert.equal(JSON.stringify(newJson.root[0].root[0].root), JSON.stringify(attributes));
2016-03-29 04:50:23 +01:00
});
2016-05-26 15:08:34 +01:00
});
2017-03-09 22:31:55 +00:00
});