added tests to properties formatting

This commit is contained in:
Dolan Miu
2016-04-04 17:30:29 +01:00
parent 4d8e443962
commit 9540b5226a
3 changed files with 15 additions and 2 deletions

View File

@ -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() {

View File

@ -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);

View File

@ -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, " "));
});
}); });
}); });