Rename properties to core properties

This commit is contained in:
Dolan Miu
2018-02-04 01:43:03 +00:00
parent 23c5aef276
commit 6a762c6c0e
7 changed files with 13 additions and 13 deletions

View File

@ -2,7 +2,7 @@ import { assert } from "chai";
import { Formatter } from "../export/formatter"; import { Formatter } from "../export/formatter";
import * as file from "../file"; import * as file from "../file";
import { Properties } from "../file/properties"; import { CoreProperties } from "../file/core-properties";
import { Attributes } from "../file/xml-components"; import { Attributes } from "../file/xml-components";
import { Utility } from "../tests/utility"; import { Utility } from "../tests/utility";
@ -67,7 +67,7 @@ describe("Formatter", () => {
}); });
it("should format Properties object correctly", () => { it("should format Properties object correctly", () => {
const properties = new Properties({ const properties = new CoreProperties({
title: "test document", title: "test document",
creator: "Dolan", creator: "Dolan",
}); });

View File

@ -34,7 +34,7 @@ export class Compiler {
const xmlDocument = xml(this.formatter.format(this.file.Document), true); const xmlDocument = xml(this.formatter.format(this.file.Document), true);
const xmlStyles = xml(this.formatter.format(this.file.Styles)); const xmlStyles = xml(this.formatter.format(this.file.Styles));
const xmlProperties = xml(this.formatter.format(this.file.Properties), { const xmlProperties = xml(this.formatter.format(this.file.CoreProperties), {
declaration: { declaration: {
standalone: "yes", standalone: "yes",
encoding: "UTF-8", encoding: "UTF-8",

View File

@ -1,12 +1,12 @@
import { expect } from "chai"; import { expect } from "chai";
import { Formatter } from "../../export/formatter"; import { Formatter } from "../../export/formatter";
import { Properties } from "./properties"; import { CoreProperties } from "./properties";
describe("Properties", () => { describe("Properties", () => {
describe("#constructor()", () => { describe("#constructor()", () => {
it("sets the appropriate attributes on the top-level", () => { it("sets the appropriate attributes on the top-level", () => {
const properties = new Properties({}); const properties = new CoreProperties({});
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]); expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]);
expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array); expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array);
@ -22,7 +22,7 @@ describe("Properties", () => {
}); });
it("should create properties with a title", () => { it("should create properties with a title", () => {
const properties = new Properties({ title: "test document" }); const properties = new CoreProperties({ title: "test document" });
const tree = new Formatter().format(properties); const tree = new Formatter().format(properties);
expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]); expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]);
expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array); expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array);
@ -31,7 +31,7 @@ describe("Properties", () => {
}); });
it("should create properties with all the attributes given", () => { it("should create properties with all the attributes given", () => {
const properties = new Properties({ const properties = new CoreProperties({
title: "test document", title: "test document",
subject: "test subject", subject: "test subject",
creator: "me", creator: "me",

View File

@ -12,7 +12,7 @@ export interface IPropertiesOptions {
revision?: string; revision?: string;
} }
export class Properties extends XmlComponent { export class CoreProperties extends XmlComponent {
constructor(options: IPropertiesOptions) { constructor(options: IPropertiesOptions) {
super("cp:coreProperties"); super("cp:coreProperties");
this.root.push( this.root.push(

View File

@ -1,4 +1,5 @@
import { ContentTypes } from "./content-types/content-types"; import { ContentTypes } from "./content-types/content-types";
import { CoreProperties, IPropertiesOptions } from "./core-properties";
import { Document } from "./document"; import { Document } from "./document";
import { SectionPropertiesOptions } from "./document/body/section-properties/section-properties"; import { SectionPropertiesOptions } from "./document/body/section-properties/section-properties";
import { FooterWrapper } from "./footer-wrapper"; import { FooterWrapper } from "./footer-wrapper";
@ -6,7 +7,6 @@ import { HeaderWrapper } from "./header-wrapper";
import { Media } from "./media"; import { Media } from "./media";
import { Numbering } from "./numbering"; import { Numbering } from "./numbering";
import { Paragraph } from "./paragraph"; import { Paragraph } from "./paragraph";
import { IPropertiesOptions, Properties } from "./properties";
import { Relationships } from "./relationships"; import { Relationships } from "./relationships";
import { Styles } from "./styles"; import { Styles } from "./styles";
import { DefaultStylesFactory } from "./styles/factory"; import { DefaultStylesFactory } from "./styles/factory";
@ -15,7 +15,7 @@ import { Table } from "./table";
export class File { export class File {
private readonly document: Document; private readonly document: Document;
private readonly styles: Styles; private readonly styles: Styles;
private readonly properties: Properties; private readonly coreProperties: CoreProperties;
private readonly numbering: Numbering; private readonly numbering: Numbering;
private readonly media: Media; private readonly media: Media;
private readonly docRelationships: Relationships; private readonly docRelationships: Relationships;
@ -37,7 +37,7 @@ export class File {
}; };
} }
this.properties = new Properties(options); this.coreProperties = new CoreProperties(options);
this.numbering = new Numbering(); this.numbering = new Numbering();
this.docRelationships = new Relationships(); this.docRelationships = new Relationships();
this.docRelationships.createRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml"); this.docRelationships.createRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml");
@ -88,8 +88,8 @@ export class File {
return this.styles; return this.styles;
} }
public get Properties(): Properties { public get CoreProperties(): CoreProperties {
return this.properties; return this.coreProperties;
} }
public get Numbering(): Numbering { public get Numbering(): Numbering {