Files
docx-js/src/file/document/document-background/document-background.spec.ts

52 lines
1.8 KiB
TypeScript
Raw Normal View History

2020-10-27 01:54:40 +00:00
import { expect } from "chai";
import { Formatter } from "export/formatter";
import { DocumentBackground } from "./document-background";
describe("DocumentBackground", () => {
describe("#constructor()", () => {
it("should create a DocumentBackground with no options", () => {
2020-10-27 01:54:40 +00:00
const documentBackground = new DocumentBackground({});
const tree = new Formatter().format(documentBackground);
expect(tree).to.deep.equal({
"w:background": {
_attr: {},
2020-10-27 01:54:40 +00:00
},
});
});
it("should create a DocumentBackground with no options and set color to value", () => {
2020-10-28 01:05:31 +00:00
const documentBackground = new DocumentBackground({ color: "ffff00" });
2020-10-27 01:54:40 +00:00
const tree = new Formatter().format(documentBackground);
expect(tree).to.deep.equal({
"w:background": {
_attr: {
2020-10-28 01:05:31 +00:00
"w:color": "ffff00",
2020-10-27 01:54:40 +00:00
},
},
});
});
it("should create a DocumentBackground with no options and set other values", () => {
const documentBackground = new DocumentBackground({
2020-10-28 01:05:31 +00:00
color: "ffff00",
2020-10-27 01:54:40 +00:00
themeColor: "test",
themeShade: "0A",
themeTint: "0B",
2020-10-27 01:54:40 +00:00
});
const tree = new Formatter().format(documentBackground);
expect(tree).to.deep.equal({
"w:background": {
_attr: {
2020-10-28 01:05:31 +00:00
"w:color": "ffff00",
2020-10-27 01:54:40 +00:00
"w:themeColor": "test",
"w:themeShade": "0A",
"w:themeTint": "0B",
2020-10-27 01:54:40 +00:00
},
},
});
});
});
});