2016-03-28 00:53:24 +01:00
|
|
|
/// <reference path="../typings/mocha/mocha.d.ts" />
|
|
|
|
/// <reference path="../typings/lodash/lodash.d.ts" />
|
|
|
|
|
|
|
|
import {Formatter} from "../export/Formatter";
|
2016-03-31 05:28:19 +01:00
|
|
|
import * as docx from "../docx";
|
|
|
|
|
|
|
|
function jsonify(obj: Object) {
|
|
|
|
var stringifiedJson = JSON.stringify(obj);
|
|
|
|
return JSON.parse(stringifiedJson);
|
|
|
|
}
|
2016-03-28 00:53:24 +01:00
|
|
|
|
2016-03-31 04:33:06 +01:00
|
|
|
describe.only('Formatter', () => {
|
2016-03-28 00:53:24 +01:00
|
|
|
var formatter: Formatter;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
formatter = new Formatter();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#format()', () => {
|
2016-03-31 05:28:19 +01:00
|
|
|
it("should format simple paragraph", () => {
|
|
|
|
var paragraph = new docx.Paragraph();
|
|
|
|
var newJson = formatter.format(paragraph);
|
|
|
|
newJson = jsonify(newJson);
|
|
|
|
console.log(newJson);
|
2016-03-31 04:33:06 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should should change 'p' tag into 'w:p' tag", () => {
|
|
|
|
var newJson = formatter.format({ "p": "test" });
|
2016-03-28 00:53:24 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|