From 9540b5226ae63fc694ea3a1588139cc2ea6a360d Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Mon, 4 Apr 2016 17:30:29 +0100 Subject: [PATCH] added tests to properties formatting --- ts/properties/components.ts | 2 +- ts/tests/bodyTest.ts | 2 +- ts/tests/formatterTest.ts | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ts/properties/components.ts b/ts/properties/components.ts index c91a3790b5..efa8dcba39 100644 --- a/ts/properties/components.ts +++ b/ts/properties/components.ts @@ -126,7 +126,7 @@ export class Created extends DateComponent implements XmlComponent { private created: Array; xmlKeys = { - revision: "dcterms:created" + created: "dcterms:created" } constructor() { diff --git a/ts/tests/bodyTest.ts b/ts/tests/bodyTest.ts index 5a9a277ada..96e454c5d8 100644 --- a/ts/tests/bodyTest.ts +++ b/ts/tests/bodyTest.ts @@ -15,7 +15,7 @@ describe("Body", () => { body = new Body(); }); - describe('#constructor()', () => { + describe("#constructor()", () => { it("should create the Section Properties", () => { var newJson = jsonify(body); diff --git a/ts/tests/formatterTest.ts b/ts/tests/formatterTest.ts index 9b24e750b6..7bafa9d09e 100644 --- a/ts/tests/formatterTest.ts +++ b/ts/tests/formatterTest.ts @@ -5,6 +5,7 @@ import {Formatter} from "../export/Formatter"; import * as docx from "../docx"; import {Attributes} from "../docx/xml-components"; +import {Properties} from "../properties"; import {assert} from "chai"; @@ -25,6 +26,8 @@ describe("Formatter", () => { var paragraph = new docx.Paragraph(); var newJson = formatter.format(paragraph); newJson = jsonify(newJson); + console.log(JSON.stringify(newJson, null, " ")); + assert.isDefined(newJson["w:p"]); }); @@ -58,5 +61,15 @@ describe("Formatter", () => { var newJson = formatter.format({ "p": "test", "xmlKeys": { "p": "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, " ")); + }); }); }); \ No newline at end of file