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

49 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-06-26 22:12:18 +01:00
import { assert, expect } from "chai";
2019-06-26 22:12:18 +01:00
import { Formatter } from "export/formatter";
2018-10-26 01:04:07 +01:00
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", () => {
2019-06-26 22:12:18 +01:00
const tree = new Formatter().format(thematicBreak);
expect(tree).to.deep.equal({
"w:pBdr": [
{
"w:bottom": {
_attr: {
"w:color": "auto",
"w:space": 1,
"w:sz": 6,
2019-06-26 22:12:18 +01:00
"w:val": "single",
},
},
},
],
});
2016-03-29 04:50:23 +01:00
});
2016-05-26 15:08:34 +01:00
});
2017-03-09 22:31:55 +00:00
});