Run updated prettier

This commit is contained in:
Max Lay
2020-08-04 08:50:56 +12:00
parent 870c222dd5
commit ec4c4fb5c4
2 changed files with 15 additions and 14 deletions

View File

@ -10,7 +10,7 @@ describe("CustomProperties", () => {
expect(tree).to.deep.equal({ expect(tree).to.deep.equal({
Properties: { Properties: {
_attr: { _attr: {
"xmlns": "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
"xmlns:vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", "xmlns:vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",
}, },
}, },
@ -18,13 +18,16 @@ describe("CustomProperties", () => {
}); });
it("should create custom properties with all the attributes given", () => { it("should create custom properties with all the attributes given", () => {
const properties = new CustomProperties([{ name: "Address", value: "123" }, { name: "Author", value: "456" }]); const properties = new CustomProperties([
{ name: "Address", value: "123" },
{ name: "Author", value: "456" },
]);
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(tree).to.deep.equal({ expect(tree).to.deep.equal({
Properties: [ Properties: [
{ {
_attr: { _attr: {
"xmlns": "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
"xmlns:vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes", "xmlns:vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",
}, },
}, },
@ -38,9 +41,7 @@ describe("CustomProperties", () => {
}, },
}, },
{ {
"vt:lpwstr": [ "vt:lpwstr": ["123"],
"123",
],
}, },
], ],
}, },
@ -54,9 +55,7 @@ describe("CustomProperties", () => {
}, },
}, },
{ {
"vt:lpwstr": [ "vt:lpwstr": ["456"],
"456",
],
}, },
], ],
}, },

View File

@ -9,11 +9,13 @@ export interface ICustomPropertyOptions {
export class CustomProperty extends XmlComponent { export class CustomProperty extends XmlComponent {
constructor(id: number, properties: ICustomPropertyOptions) { constructor(id: number, properties: ICustomPropertyOptions) {
super("property"); super("property");
this.root.push(new CustomPropertyAttributes({ this.root.push(
fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}", new CustomPropertyAttributes({
pid: id.toString(), fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
name: properties.name, pid: id.toString(),
})); name: properties.name,
}),
);
this.root.push(new CustomPropertyValue(properties.value)); this.root.push(new CustomPropertyValue(properties.value));
} }
} }