Merge pull request #1285 from erlend-axelsson/master
Dont set background color if none is provided in options
This commit is contained in:
@ -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: {},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
// </xsd:simpleType>
|
||||
|
||||
export class DocumentBackgroundAttributes extends XmlAttributeComponent<{
|
||||
readonly color: string;
|
||||
readonly color?: string;
|
||||
readonly themeColor?: string;
|
||||
readonly themeShade?: string;
|
||||
readonly themeTint?: string;
|
||||
@ -68,7 +68,7 @@ export class DocumentBackground extends XmlComponent {
|
||||
|
||||
this.root.push(
|
||||
new DocumentBackgroundAttributes({
|
||||
color: hexColorValue(options.color ? options.color : "FFFFFF"),
|
||||
color: options.color === undefined ? undefined : hexColorValue(options.color),
|
||||
themeColor: options.themeColor,
|
||||
themeShade: options.themeShade === undefined ? undefined : uCharHexNumber(options.themeShade),
|
||||
themeTint: options.themeTint === undefined ? undefined : uCharHexNumber(options.themeTint),
|
||||
|
@ -40,9 +40,7 @@ describe("Document", () => {
|
||||
},
|
||||
{
|
||||
"w:background": {
|
||||
_attr: {
|
||||
"w:color": "FFFFFF",
|
||||
},
|
||||
_attr: {},
|
||||
},
|
||||
},
|
||||
{ "w:body": {} },
|
||||
|
Reference in New Issue
Block a user