Breaking Change. Swap arguments around and make default WidthType

This commit is contained in:
Dolan Miu
2018-11-15 03:00:26 +00:00
parent 28556f277b
commit e19890e27a
7 changed files with 50 additions and 11 deletions

View File

@ -176,8 +176,8 @@ describe("Table", () => {
});
describe("#setWidth", () => {
it("sets the preferred width on the table", () => {
const table = new Table(2, 2).setWidth(WidthType.PERCENTAGE, 1000);
it("should set the preferred width on the table", () => {
const table = new Table(2, 2).setWidth(1000, WidthType.PERCENTAGE);
const tree = new Formatter().format(table);
expect(tree)
.to.have.property("w:tbl")
@ -187,6 +187,15 @@ describe("Table", () => {
"w:tblPr": [DEFAULT_TABLE_PROPERTIES, { "w:tblW": [{ _attr: { "w:type": "pct", "w:w": 1000 } }] }],
});
});
it("sets the preferred width on the table with a default of AUTO", () => {
const table = new Table(2, 2).setWidth(1000);
const tree = new Formatter().format(table);
expect(tree["w:tbl"][0]).to.deep.equal({
"w:tblPr": [DEFAULT_TABLE_PROPERTIES, { "w:tblW": [{ _attr: { "w:type": "auto", "w:w": 1000 } }] }],
});
});
});
describe("#setFixedWidthLayout", () => {