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()", () => {
|
2021-11-12 10:21:01 +01:00
|
|
|
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": {
|
2021-11-12 10:21:01 +01:00
|
|
|
_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",
|
2021-05-25 03:41:12 +03:00
|
|
|
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",
|
2021-05-25 03:41:12 +03:00
|
|
|
"w:themeShade": "0A",
|
|
|
|
"w:themeTint": "0B",
|
2020-10-27 01:54:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|