add settings option to add trackRevisions
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
import { Compatibility } from "./compatibility";
|
||||
import { UpdateFields } from "./update-fields";
|
||||
import { TrackRevisions } from "./track-revisions";
|
||||
|
||||
export interface ISettingsAttributesProperties {
|
||||
readonly wpc?: string;
|
||||
@ -46,6 +47,7 @@ export class SettingsAttributes extends XmlAttributeComponent<ISettingsAttribute
|
||||
|
||||
export class Settings extends XmlComponent {
|
||||
private readonly compatibility;
|
||||
private readonly trackRevisions;
|
||||
|
||||
constructor() {
|
||||
super("w:settings");
|
||||
@ -71,6 +73,7 @@ export class Settings extends XmlComponent {
|
||||
}),
|
||||
);
|
||||
this.compatibility = new Compatibility();
|
||||
this.trackRevisions = new TrackRevisions();
|
||||
}
|
||||
|
||||
public addUpdateFields(): void {
|
||||
@ -86,4 +89,12 @@ export class Settings extends XmlComponent {
|
||||
|
||||
return this.compatibility;
|
||||
}
|
||||
|
||||
public addTrackRevisions(): TrackRevisions {
|
||||
if (!this.root.find((child) => child instanceof TrackRevisions)) {
|
||||
this.addChildElement(this.trackRevisions);
|
||||
}
|
||||
|
||||
return this.trackRevisions;
|
||||
}
|
||||
}
|
||||
|
16
src/file/settings/track-revisions.spec.ts
Normal file
16
src/file/settings/track-revisions.spec.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { expect } from "chai";
|
||||
import { Formatter } from "export/formatter";
|
||||
import { TrackRevisions } from "file/settings/track-revisions";
|
||||
|
||||
import { EMPTY_OBJECT } from "file/xml-components";
|
||||
|
||||
describe("TrackRevisions", () => {
|
||||
describe("#constructor", () => {
|
||||
it("creates an initially empty property object", () => {
|
||||
const trackRevisions = new TrackRevisions();
|
||||
|
||||
const tree = new Formatter().format(trackRevisions);
|
||||
expect(tree).to.deep.equal({ "w:trackRevisions": EMPTY_OBJECT });
|
||||
});
|
||||
});
|
||||
});
|
7
src/file/settings/track-revisions.ts
Normal file
7
src/file/settings/track-revisions.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class TrackRevisions extends XmlComponent {
|
||||
constructor() {
|
||||
super("w:trackRevisions");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user