unordered list tests
This commit is contained in:
@ -10,7 +10,7 @@ export class NumberProperties extends XmlComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export class IndentLevel extends XmlComponent {
|
||||
class IndentLevel extends XmlComponent {
|
||||
|
||||
constructor(level: number) {
|
||||
super("w:ilvl");
|
||||
@ -20,7 +20,7 @@ export class IndentLevel extends XmlComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export class NumberId extends XmlComponent {
|
||||
class NumberId extends XmlComponent {
|
||||
constructor(id: number) {
|
||||
super("w:numId");
|
||||
this.root.push(new Attributes({
|
||||
|
32
ts/tests/docx/paragraph/unorderedListTests.ts
Normal file
32
ts/tests/docx/paragraph/unorderedListTests.ts
Normal file
@ -0,0 +1,32 @@
|
||||
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();
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
|
||||
it("should create a Page Break with a Number Id inside", () => {
|
||||
let newJson = jsonify(numberProperties);
|
||||
assert.equal(newJson.root[1].rootKey, "w:numId");
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user