2019-09-29 04:17:21 +01:00
|
|
|
import { expect } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
2019-06-26 22:12:18 +01:00
|
|
|
import { Formatter } from "export/formatter";
|
2018-10-26 01:04:07 +01:00
|
|
|
|
2019-09-29 04:17:21 +01:00
|
|
|
import { Border, ThematicBreak } from "./border";
|
2016-03-29 04:50:23 +01:00
|
|
|
|
|
|
|
describe("Border", () => {
|
2019-09-29 04:17:21 +01:00
|
|
|
describe("#constructor", () => {
|
|
|
|
it("should create", () => {
|
|
|
|
const border = new Border({
|
|
|
|
top: {
|
|
|
|
color: "red",
|
|
|
|
space: 1,
|
|
|
|
value: "test",
|
|
|
|
size: 2,
|
|
|
|
},
|
|
|
|
bottom: {
|
|
|
|
color: "red",
|
|
|
|
space: 3,
|
|
|
|
value: "test",
|
|
|
|
size: 4,
|
|
|
|
},
|
|
|
|
left: {
|
|
|
|
color: "red",
|
|
|
|
space: 5,
|
|
|
|
value: "test",
|
|
|
|
size: 6,
|
|
|
|
},
|
|
|
|
right: {
|
|
|
|
color: "red",
|
|
|
|
space: 7,
|
|
|
|
value: "test",
|
|
|
|
size: 8,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const tree = new Formatter().format(border);
|
|
|
|
|
|
|
|
expect(tree).to.deep.equal({
|
|
|
|
"w:pBdr": [
|
|
|
|
{
|
|
|
|
"w:top": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "red",
|
|
|
|
"w:space": 1,
|
|
|
|
"w:sz": 2,
|
|
|
|
"w:val": "test",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:bottom": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "red",
|
|
|
|
"w:space": 3,
|
|
|
|
"w:sz": 4,
|
|
|
|
"w:val": "test",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:left": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "red",
|
|
|
|
"w:space": 5,
|
|
|
|
"w:sz": 6,
|
|
|
|
"w:val": "test",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"w:right": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "red",
|
|
|
|
"w:space": 7,
|
|
|
|
"w:sz": 8,
|
|
|
|
"w:val": "test",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
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()", () => {
|
|
|
|
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",
|
2019-07-02 01:33:41 +01:00
|
|
|
"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
|
|
|
});
|