Clean up API

This commit is contained in:
Dolan
2018-08-07 01:25:28 +01:00
parent ca8f331eec
commit 12c8cb93f6
21 changed files with 95 additions and 49 deletions

View File

@ -22,9 +22,9 @@ describe("TableProperties", () => {
});
});
describe("#fixedWidthLayout", () => {
describe("#setFixedWidthLayout", () => {
it("sets the table to fixed width layout", () => {
const tp = new TableProperties().fixedWidthLayout();
const tp = new TableProperties().setFixedWidthLayout();
const tree = new Formatter().format(tp);
expect(tree).to.deep.equal({
"w:tblPr": [{ "w:tblLayout": [{ _attr: { "w:type": "fixed" } }] }],

View File

@ -12,7 +12,7 @@ export class TableProperties extends XmlComponent {
return this;
}
public fixedWidthLayout(): TableProperties {
public setFixedWidthLayout(): TableProperties {
this.root.push(new TableLayout("fixed"));
return this;
}

View File

@ -186,9 +186,9 @@ describe("Table", () => {
});
});
describe("#fixedWidthLayout", () => {
describe("#setFixedWidthLayout", () => {
it("sets the table to fixed width layout", () => {
const table = new Table(2, 2).fixedWidthLayout();
const table = new Table(2, 2).setFixedWidthLayout();
const tree = new Formatter().format(table);
expect(tree)
.to.have.property("w:tbl")

View File

@ -72,8 +72,8 @@ export class Table extends XmlComponent {
return this;
}
public fixedWidthLayout(): Table {
this.properties.fixedWidthLayout();
public setFixedWidthLayout(): Table {
this.properties.setFixedWidthLayout();
return this;
}
}
@ -94,7 +94,7 @@ export class TableRow extends XmlComponent {
public addGridSpan(ix: number, cellSpan: number): TableCell {
const remainCell = this.cells[ix];
remainCell.cellProperties.addGridSpan(cellSpan);
remainCell.CellProperties.addGridSpan(cellSpan);
this.cells.splice(ix + 1, cellSpan - 1);
this.root.splice(ix + 2, cellSpan - 1);
@ -138,7 +138,7 @@ export class TableCell extends XmlComponent {
return para;
}
public get cellProperties(): TableCellProperties {
public get CellProperties(): TableCellProperties {
return this.properties;
}
}
@ -151,7 +151,7 @@ export class TableCellProperties extends XmlComponent {
this.root.push(this.cellBorder);
}
public get borders(): TableCellBorders {
public get Borders(): TableCellBorders {
return this.cellBorder;
}
@ -167,8 +167,8 @@ export class TableCellProperties extends XmlComponent {
return this;
}
public setVerticalAlign(vAlignType: VerticalAlign): TableCellProperties {
this.root.push(new VAlign(vAlignType));
public setVerticalAlign(type: VerticalAlign): TableCellProperties {
this.root.push(new VAlign(type));
return this;
}