added tests to properties formatting
This commit is contained in:
@ -126,7 +126,7 @@ export class Created extends DateComponent implements XmlComponent {
|
|||||||
private created: Array<XmlComponent>;
|
private created: Array<XmlComponent>;
|
||||||
|
|
||||||
xmlKeys = {
|
xmlKeys = {
|
||||||
revision: "dcterms:created"
|
created: "dcterms:created"
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -15,7 +15,7 @@ describe("Body", () => {
|
|||||||
body = new Body();
|
body = new Body();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#constructor()', () => {
|
describe("#constructor()", () => {
|
||||||
|
|
||||||
it("should create the Section Properties", () => {
|
it("should create the Section Properties", () => {
|
||||||
var newJson = jsonify(body);
|
var newJson = jsonify(body);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import {Formatter} from "../export/Formatter";
|
import {Formatter} from "../export/Formatter";
|
||||||
import * as docx from "../docx";
|
import * as docx from "../docx";
|
||||||
import {Attributes} from "../docx/xml-components";
|
import {Attributes} from "../docx/xml-components";
|
||||||
|
import {Properties} from "../properties";
|
||||||
|
|
||||||
import {assert} from "chai";
|
import {assert} from "chai";
|
||||||
|
|
||||||
@ -25,6 +26,8 @@ describe("Formatter", () => {
|
|||||||
var paragraph = new docx.Paragraph();
|
var paragraph = new docx.Paragraph();
|
||||||
var newJson = formatter.format(paragraph);
|
var newJson = formatter.format(paragraph);
|
||||||
newJson = jsonify(newJson);
|
newJson = jsonify(newJson);
|
||||||
|
console.log(JSON.stringify(newJson, null, " "));
|
||||||
|
|
||||||
assert.isDefined(newJson["w:p"]);
|
assert.isDefined(newJson["w:p"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -58,5 +61,15 @@ describe("Formatter", () => {
|
|||||||
var newJson = formatter.format({ "p": "test", "xmlKeys": { "p": "w:p" } });
|
var newJson = formatter.format({ "p": "test", "xmlKeys": { "p": "w:p" } });
|
||||||
assert.isDefined(newJson["w:p"]);
|
assert.isDefined(newJson["w:p"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.only("should format Properties object correctly", () => {
|
||||||
|
var properties = new Properties({
|
||||||
|
title: "test document",
|
||||||
|
creator: "Dolan"
|
||||||
|
});
|
||||||
|
var newJson = formatter.format(properties);
|
||||||
|
newJson = jsonify(newJson);
|
||||||
|
console.log(JSON.stringify(newJson, null, " "));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Reference in New Issue
Block a user