Rename properties to core properties
This commit is contained in:
@ -2,7 +2,7 @@ import { assert } from "chai";
|
||||
|
||||
import { Formatter } from "../export/formatter";
|
||||
import * as file from "../file";
|
||||
import { Properties } from "../file/properties";
|
||||
import { CoreProperties } from "../file/core-properties";
|
||||
import { Attributes } from "../file/xml-components";
|
||||
import { Utility } from "../tests/utility";
|
||||
|
||||
@ -67,7 +67,7 @@ describe("Formatter", () => {
|
||||
});
|
||||
|
||||
it("should format Properties object correctly", () => {
|
||||
const properties = new Properties({
|
||||
const properties = new CoreProperties({
|
||||
title: "test document",
|
||||
creator: "Dolan",
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ export class Compiler {
|
||||
|
||||
const xmlDocument = xml(this.formatter.format(this.file.Document), true);
|
||||
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: {
|
||||
standalone: "yes",
|
||||
encoding: "UTF-8",
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "../../export/formatter";
|
||||
import { Properties } from "./properties";
|
||||
import { CoreProperties } from "./properties";
|
||||
|
||||
describe("Properties", () => {
|
||||
describe("#constructor()", () => {
|
||||
it("sets the appropriate attributes on the top-level", () => {
|
||||
const properties = new Properties({});
|
||||
const properties = new CoreProperties({});
|
||||
const tree = new Formatter().format(properties);
|
||||
expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]);
|
||||
expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array);
|
||||
@ -22,7 +22,7 @@ describe("Properties", () => {
|
||||
});
|
||||
|
||||
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);
|
||||
expect(Object.keys(tree)).to.deep.equal(["cp:coreProperties"]);
|
||||
expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array);
|
||||
@ -31,7 +31,7 @@ describe("Properties", () => {
|
||||
});
|
||||
|
||||
it("should create properties with all the attributes given", () => {
|
||||
const properties = new Properties({
|
||||
const properties = new CoreProperties({
|
||||
title: "test document",
|
||||
subject: "test subject",
|
||||
creator: "me",
|
@ -12,7 +12,7 @@ export interface IPropertiesOptions {
|
||||
revision?: string;
|
||||
}
|
||||
|
||||
export class Properties extends XmlComponent {
|
||||
export class CoreProperties extends XmlComponent {
|
||||
constructor(options: IPropertiesOptions) {
|
||||
super("cp:coreProperties");
|
||||
this.root.push(
|
@ -1,4 +1,5 @@
|
||||
import { ContentTypes } from "./content-types/content-types";
|
||||
import { CoreProperties, IPropertiesOptions } from "./core-properties";
|
||||
import { Document } from "./document";
|
||||
import { SectionPropertiesOptions } from "./document/body/section-properties/section-properties";
|
||||
import { FooterWrapper } from "./footer-wrapper";
|
||||
@ -6,7 +7,6 @@ import { HeaderWrapper } from "./header-wrapper";
|
||||
import { Media } from "./media";
|
||||
import { Numbering } from "./numbering";
|
||||
import { Paragraph } from "./paragraph";
|
||||
import { IPropertiesOptions, Properties } from "./properties";
|
||||
import { Relationships } from "./relationships";
|
||||
import { Styles } from "./styles";
|
||||
import { DefaultStylesFactory } from "./styles/factory";
|
||||
@ -15,7 +15,7 @@ import { Table } from "./table";
|
||||
export class File {
|
||||
private readonly document: Document;
|
||||
private readonly styles: Styles;
|
||||
private readonly properties: Properties;
|
||||
private readonly coreProperties: CoreProperties;
|
||||
private readonly numbering: Numbering;
|
||||
private readonly media: Media;
|
||||
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.docRelationships = new Relationships();
|
||||
this.docRelationships.createRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml");
|
||||
@ -88,8 +88,8 @@ export class File {
|
||||
return this.styles;
|
||||
}
|
||||
|
||||
public get Properties(): Properties {
|
||||
return this.properties;
|
||||
public get CoreProperties(): CoreProperties {
|
||||
return this.coreProperties;
|
||||
}
|
||||
|
||||
public get Numbering(): Numbering {
|
||||
|
Reference in New Issue
Block a user