Files
docx-js/ts/tests/docx/paragraph/unorderedListTests.ts
felipe 52c4e3cabd allow NumberProperties to specify custom id/level
This change allows callers to create custom numbering styles and
attach them to paragraphs
2017-03-08 16:20:44 +01:00

34 lines
1.1 KiB
TypeScript

import { NumberProperties } from "../../../docx/paragraph/unordered-list";
import { assert } from "chai";
function jsonify(obj: Object) {
let stringifiedJson = JSON.stringify(obj);
return JSON.parse(stringifiedJson);
}
describe("NumberProperties", () => {
let numberProperties: NumberProperties;
beforeEach(() => {
numberProperties = new NumberProperties(5, 10);
});
describe("#constructor()", () => {
it("should create a Number Properties with correct root key", () => {
let newJson = jsonify(numberProperties);
assert.equal(newJson.rootKey, "w:numPr");
});
it("should create a Page Break with a Indent Level inside", () => {
let newJson = jsonify(numberProperties);
assert.equal(newJson.root[0].rootKey, "w:ilvl");
assert.equal(newJson.root[0].root[0].root.val, 10);
});
it("should create a Page Break with a Number Id inside", () => {
let newJson = jsonify(numberProperties);
assert.equal(newJson.root[1].rootKey, "w:numId");
assert.equal(newJson.root[1].root[0].root.val, 5);
});
});
});