style fixes

This commit is contained in:
Thomas Jansen
2020-09-24 10:43:15 +02:00
parent 09db2c528a
commit 065c17de74
3 changed files with 32 additions and 37 deletions

View File

@ -13,4 +13,4 @@ export * from "./header-wrapper";
export * from "./footer-wrapper"; export * from "./footer-wrapper";
export * from "./header"; export * from "./header";
export * from "./footnotes"; export * from "./footnotes";
export * from "./track-revision" export * from "./track-revision";

View File

@ -9,36 +9,34 @@ describe("InsertedTestRun", () => {
describe("#constructor", () => { describe("#constructor", () => {
it("should create a inserted text run", () => { it("should create a inserted text run", () => {
const textRun = new TextRun({ const textRun = new TextRun({
text: "some text" text: "some text",
}); });
const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }) const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" });
const tree = new Formatter().format(insertedTextRun); const tree = new Formatter().format(insertedTextRun);
expect(tree).to.deep.equal({ expect(tree).to.deep.equal({
"w:ins": [ "w:ins": [
{ {
"_attr": _attr: {
{
"w:author": "Author", "w:author": "Author",
"w:date": "123", "w:date": "123",
"w:id": 0 "w:id": 0,
} },
}, },
{ {
"w:r": [ "w:r": [
{ {
"w:t": [ "w:t": [
{ {
"_attr": _attr: {
{ "xml:space": "preserve",
"xml:space": "preserve" },
} },
"some text",
],
},
],
}, },
"some text"
]
}
], ],
}
]
}); });
}); });
}); });
@ -46,35 +44,32 @@ describe("InsertedTestRun", () => {
describe("DeletedTestRun", () => { describe("DeletedTestRun", () => {
describe("#constructor", () => { describe("#constructor", () => {
it("should create a deleted text run", () => { it("should create a deleted text run", () => {
const insertedParagraph = new DeletedTextRun({ text: "some text", id: 0, date: "123", author: "Author" });
const insertedParagraph = new DeletedTextRun({ text: 'some text', id: 0, date: "123", author: "Author" })
const tree = new Formatter().format(insertedParagraph); const tree = new Formatter().format(insertedParagraph);
expect(tree).to.deep.equal({ expect(tree).to.deep.equal({
"w:del": [ "w:del": [
{ {
"_attr": _attr: {
{
"w:author": "Author", "w:author": "Author",
"w:date": "123", "w:date": "123",
"w:id": 0 "w:id": 0,
} },
}, },
{ {
"w:r": [ "w:r": [
{ {
"w:delText": [ "w:delText": [
{ {
"_attr": _attr: {
{ "xml:space": "preserve",
"xml:space": "preserve" },
} },
"some text",
],
},
],
}, },
"some text"
]
}
], ],
}
]
}); });
}); });
}); });

View File

@ -17,11 +17,11 @@ export class TrackRevisionAttributes extends XmlAttributeComponent<ITrackRevisio
} }
export interface IInsertedTextRunOptions extends ITrackRevisionAttributesProperties { export interface IInsertedTextRunOptions extends ITrackRevisionAttributesProperties {
readonly child: TextRun readonly child: TextRun;
} }
export interface IDeletedTextRunOptions extends ITrackRevisionAttributesProperties { export interface IDeletedTextRunOptions extends ITrackRevisionAttributesProperties {
readonly text: string readonly text: string;
} }
export class InsertedTextRun extends XmlComponent { export class InsertedTextRun extends XmlComponent {
@ -32,7 +32,7 @@ export class InsertedTextRun extends XmlComponent {
id: options.id, id: options.id,
author: options.author, author: options.author,
date: options.date, date: options.date,
}) }),
); );
this.addChildElement(options.child); this.addChildElement(options.child);
} }
@ -65,7 +65,7 @@ export class DeletedTextRun extends XmlComponent {
id: options.id, id: options.id,
author: options.author, author: options.author,
date: options.date, date: options.date,
}) }),
); );
this.addChildElement(new DeletedTextRunWrapper(options.text)); this.addChildElement(new DeletedTextRunWrapper(options.text));
} }