2017-03-10 17:38:04 +01:00
|
|
|
import { expect } from "chai";
|
2017-09-17 00:00:41 +01:00
|
|
|
|
|
|
|
import { Formatter } from "../../export/formatter";
|
|
|
|
import { TableProperties } from "./properties";
|
2017-03-10 17:38:04 +01:00
|
|
|
|
|
|
|
describe("TableProperties", () => {
|
|
|
|
describe("#constructor", () => {
|
|
|
|
it("creates an initially empty property object", () => {
|
|
|
|
const tp = new TableProperties();
|
|
|
|
const tree = new Formatter().format(tp);
|
2018-01-23 01:33:12 +00:00
|
|
|
expect(tree).to.deep.equal({ "w:tblPr": [] });
|
2017-03-10 17:38:04 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#setWidth", () => {
|
|
|
|
it("adds a table width property", () => {
|
|
|
|
const tp = new TableProperties().setWidth("dxa", 1234);
|
|
|
|
const tree = new Formatter().format(tp);
|
|
|
|
expect(tree).to.deep.equal({
|
2018-01-23 01:33:12 +00:00
|
|
|
"w:tblPr": [{ "w:tblW": [{ _attr: { "w:type": "dxa", "w:w": 1234 } }] }],
|
2017-03-10 17:38:04 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-03-11 09:59:29 +01:00
|
|
|
|
2018-08-07 01:25:28 +01:00
|
|
|
describe("#setFixedWidthLayout", () => {
|
2017-03-11 09:59:29 +01:00
|
|
|
it("sets the table to fixed width layout", () => {
|
2018-08-07 01:25:28 +01:00
|
|
|
const tp = new TableProperties().setFixedWidthLayout();
|
2017-03-11 09:59:29 +01:00
|
|
|
const tree = new Formatter().format(tp);
|
|
|
|
expect(tree).to.deep.equal({
|
2018-01-23 01:33:12 +00:00
|
|
|
"w:tblPr": [{ "w:tblLayout": [{ _attr: { "w:type": "fixed" } }] }],
|
2017-03-11 09:59:29 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-03-10 17:38:04 +01:00
|
|
|
});
|