Add tests
This commit is contained in:
22
src/file/table/table-properties/table-style.spec.ts
Normal file
22
src/file/table/table-properties/table-style.spec.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "export/formatter";
|
||||
|
||||
import { TableStyle } from "./table-style";
|
||||
|
||||
describe("TableStyle", () => {
|
||||
describe("#constructor", () => {
|
||||
it("should create", () => {
|
||||
const tableStyle = new TableStyle("test-id");
|
||||
const tree = new Formatter().format(tableStyle);
|
||||
|
||||
expect(tree).to.deep.equal({
|
||||
"w:tblStyle": {
|
||||
_attr: {
|
||||
"w:val": "test-id",
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@ -1,11 +1,9 @@
|
||||
import { Attributes, XmlComponent } from "file/xml-components";
|
||||
|
||||
export class TableStyle extends XmlComponent {
|
||||
public readonly styleId: string;
|
||||
|
||||
constructor(styleId: string) {
|
||||
super("w:tblStyle");
|
||||
this.styleId = styleId;
|
||||
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
val: styleId,
|
||||
|
Reference in New Issue
Block a user