fixing tests
This commit is contained in:
@ -5,11 +5,6 @@ import {Paragraph} from "../paragraph";
|
||||
|
||||
export class Document extends XmlComponent {
|
||||
private body: Body;
|
||||
|
||||
xmlKeys = {
|
||||
document: "w:document",
|
||||
body: "w:body"
|
||||
};
|
||||
|
||||
constructor() {
|
||||
super("w:document");
|
||||
@ -36,7 +31,13 @@ export class Document extends XmlComponent {
|
||||
this.root.push(this.body);
|
||||
}
|
||||
|
||||
addParagraph(paragraph: Paragraph) {
|
||||
addParagraph(paragraph: Paragraph): void {
|
||||
this.body.push(paragraph);
|
||||
}
|
||||
|
||||
clearVariables(): void {
|
||||
console.log("clearing");
|
||||
this.body.clearVariables();
|
||||
delete this.body;
|
||||
}
|
||||
}
|
@ -8,6 +8,8 @@ export abstract class BaseXmlComponent {
|
||||
}
|
||||
|
||||
abstract replaceKey(): void;
|
||||
clearVariables(): void {
|
||||
};
|
||||
}
|
||||
|
||||
export abstract class XmlComponent extends BaseXmlComponent {
|
||||
@ -23,7 +25,9 @@ export abstract class XmlComponent extends BaseXmlComponent {
|
||||
//console.log(this.root);
|
||||
if (this.root !== undefined) {
|
||||
this.root.forEach(root => {
|
||||
root.replaceKey();
|
||||
if (root && root instanceof BaseXmlComponent) {
|
||||
root.replaceKey();
|
||||
}
|
||||
});
|
||||
this[this.rootKey] = this.root;
|
||||
delete this.root;
|
||||
|
Reference in New Issue
Block a user