added replacements and properties removal in formatter

This commit is contained in:
Dolan Miu
2016-03-31 05:28:19 +01:00
parent 167de85cee
commit 30ed93b2e9
2 changed files with 55 additions and 8 deletions

View File

@ -2,6 +2,12 @@
/// <reference path="../typings/lodash/lodash.d.ts" />
import {Formatter} from "../export/Formatter";
import * as docx from "../docx";
function jsonify(obj: Object) {
var stringifiedJson = JSON.stringify(obj);
return JSON.parse(stringifiedJson);
}
describe.only('Formatter', () => {
var formatter: Formatter;
@ -11,8 +17,11 @@ describe.only('Formatter', () => {
});
describe('#format()', () => {
it("should work", () => {
var newJson = formatter.format({ "p": [{ "t": "test" }] });
it("should format simple paragraph", () => {
var paragraph = new docx.Paragraph();
var newJson = formatter.format(paragraph);
newJson = jsonify(newJson);
console.log(newJson);
});
it("should should change 'p' tag into 'w:p' tag", () => {