Dont set background color if none is provided in options

After comparing the output of this library and what is
produced by Microsoft Word, it seems that document
background color is not set by default by Word.

Removing the default #FFFFFF background color enables the
generated documents to be readable in dark mode.

This seems to fix dolanmiu/docx#1093
This commit is contained in:
erlendaxelsson
2021-11-12 10:21:01 +01:00
parent 0757295213
commit ba963b0360
3 changed files with 5 additions and 9 deletions

View File

@ -6,14 +6,12 @@ import { DocumentBackground } from "./document-background";
describe("DocumentBackground", () => {
describe("#constructor()", () => {
it("should create a DocumentBackground with no options and set color to auto", () => {
it("should create a DocumentBackground with no options", () => {
const documentBackground = new DocumentBackground({});
const tree = new Formatter().format(documentBackground);
expect(tree).to.deep.equal({
"w:background": {
_attr: {
"w:color": "FFFFFF",
},
_attr: {},
},
});
});