Add OutlineLevel Paragraph property
This commit is contained in:
@ -1,2 +1,3 @@
|
||||
export * from "./hyperlink";
|
||||
export * from "./bookmark";
|
||||
export * from "./outline-level";
|
||||
|
23
src/file/paragraph/links/outline-level.spec.ts
Normal file
23
src/file/paragraph/links/outline-level.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { assert } from "chai";
|
||||
|
||||
import { Utility } from "tests/utility";
|
||||
|
||||
import { OutlineLevel } from "./outline-level";
|
||||
|
||||
describe("ParagraphOutlineLevel", () => {
|
||||
let outlineLevel: OutlineLevel;
|
||||
|
||||
describe("#constructor()", () => {
|
||||
it("should create an outlineLevel with given value", () => {
|
||||
outlineLevel = new OutlineLevel("0");
|
||||
const newJson = Utility.jsonify(outlineLevel);
|
||||
assert.equal(newJson.root[0].root.val, "0");
|
||||
});
|
||||
|
||||
it("should create an outlineLevel with blank val", () => {
|
||||
outlineLevel = new OutlineLevel("");
|
||||
const newJson = Utility.jsonify(outlineLevel);
|
||||
assert.equal(newJson.root[0].root.val, "");
|
||||
});
|
||||
});
|
||||
});
|
17
src/file/paragraph/links/outline-level.ts
Normal file
17
src/file/paragraph/links/outline-level.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// http://officeopenxml.com/WPparagraph.php
|
||||
import { Attributes, XmlComponent } from "file/xml-components";
|
||||
|
||||
export class OutlineLevel extends XmlComponent {
|
||||
public readonly level: string;
|
||||
|
||||
constructor(level: string) {
|
||||
super("w:outlineLvl");
|
||||
this.level = level;
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
val: level,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user