wrote some initial code
This commit is contained in:
1
docs/usage/table-of-contents.md
Normal file
1
docs/usage/table-of-contents.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Table of Contents
|
@ -1,7 +1,26 @@
|
|||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
|
import { Formatter } from "../../export/formatter";
|
||||||
|
import { TableOfContents } from "./";
|
||||||
|
|
||||||
|
const DEFAULT_TOC = {
|
||||||
|
"w:std": {
|
||||||
|
"w:sdtPr": {},
|
||||||
|
"w:sdtEndPr": {},
|
||||||
|
"w:sdtContent": {
|
||||||
|
"w:p": {
|
||||||
|
"w:pPr": {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
describe("Table of Contents", () => {
|
describe("Table of Contents", () => {
|
||||||
it("should be true", () => {
|
describe("#constructor", () => {
|
||||||
expect(1).to.be.equal(1);
|
it("should construct a TOC with default options", () => {
|
||||||
|
const toc = new TableOfContents();
|
||||||
|
const tree = new Formatter().format(toc);
|
||||||
|
expect(tree).to.be.deep.equal(DEFAULT_TOC);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "file/xml-components";
|
||||||
|
|
||||||
export class TableOfContents extends XmlComponent {}
|
import { TableOfContentsProperties } from "./properties";
|
||||||
|
|
||||||
|
export class TableOfContents extends XmlComponent {
|
||||||
|
private readonly properties: TableOfContentsProperties;
|
||||||
|
|
||||||
|
constructor(properties?: TableOfContentsProperties) {
|
||||||
|
super("w:std");
|
||||||
|
this.properties = properties || new TableOfContentsProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user