2019-03-21 01:06:07 +00:00
|
|
|
import { expect } from "chai";
|
|
|
|
|
|
|
|
import { Formatter } from "export/formatter";
|
|
|
|
|
|
|
|
import { ShadingType, TableShading } from "./shading";
|
|
|
|
|
|
|
|
describe("TableShading", () => {
|
|
|
|
describe("#constructor", () => {
|
|
|
|
it("should create", () => {
|
2019-04-09 05:27:18 -04:00
|
|
|
const shading = new TableShading({});
|
|
|
|
const tree = new Formatter().format(shading);
|
2019-03-21 01:06:07 +00:00
|
|
|
expect(tree).to.deep.equal({
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:shd": {
|
|
|
|
_attr: {},
|
|
|
|
},
|
2019-03-21 01:06:07 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create with params", () => {
|
2019-04-09 05:27:18 -04:00
|
|
|
const shading = new TableShading({ val: ShadingType.PERCENT_40, color: "FF0000", fill: "555555" });
|
|
|
|
const tree = new Formatter().format(shading);
|
2019-03-21 01:06:07 +00:00
|
|
|
expect(tree).to.deep.equal({
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:shd": {
|
|
|
|
_attr: {
|
|
|
|
"w:color": "FF0000",
|
|
|
|
"w:fill": "555555",
|
|
|
|
"w:val": "pct40",
|
2019-03-21 01:06:07 +00:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2019-03-21 01:06:07 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|