Add tests

This commit is contained in:
Dolan
2021-03-07 21:45:59 +00:00
parent b972f1789e
commit 0ec3b64ad7
2 changed files with 23 additions and 3 deletions

View 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",
},
},
});
});
});
});

View File

@ -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,