Files
docx-js/ts/tests/bodyTest.ts

45 lines
1.2 KiB
TypeScript
Raw Normal View History

2016-03-31 23:01:20 +01:00
/// <reference path="../typings/mocha/mocha.d.ts" />
/// <reference path="../typings/chai/chai.d.ts" />
import {Body} from "../docx/document/body";
import {assert} from "chai";
function jsonify(obj: Object) {
var stringifiedJson = JSON.stringify(obj);
return JSON.parse(stringifiedJson);
}
2016-04-03 01:44:18 +01:00
describe('Body', () => {
2016-03-31 23:01:20 +01:00
var body: Body;
beforeEach(() => {
body = new Body();
});
describe('#constructor()', () => {
2016-04-01 00:22:44 +01:00
it("should create the Section Properties", () => {
var newJson = jsonify(body);
assert.isDefined(newJson.body[0].sectPr);
});
it("should create the Page Size", () => {
var newJson = jsonify(body);
assert.isDefined(newJson.body[1].pgSz);
});
it("should create the Page Margin", () => {
var newJson = jsonify(body);
assert.isDefined(newJson.body[2].pgMar);
});
it("should create the Columns", () => {
var newJson = jsonify(body);
assert.isDefined(newJson.body[3].cols);
});
it("should create the Document Grid", () => {
var newJson = jsonify(body);
assert.isDefined(newJson.body[4].docGrid);
});
2016-03-31 23:01:20 +01:00
});
});