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 "./header";
export * from "./footnotes";
export * from "./track-revision"
export * from "./track-revision";

View File

@ -9,36 +9,34 @@ describe("InsertedTestRun", () => {
describe("#constructor", () => {
it("should create a inserted text run", () => {
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);
expect(tree).to.deep.equal({
"w:ins": [
{
"_attr":
{
_attr: {
"w:author": "Author",
"w:date": "123",
"w:id": 0
}
"w:date": "123",
"w:id": 0,
},
},
{
"w:r": [
{
"w:t": [
{
"_attr":
{
"xml:space": "preserve"
}
_attr: {
"xml:space": "preserve",
},
},
"some text"
]
}
"some text",
],
},
],
}
]
},
],
});
});
});
@ -46,35 +44,32 @@ describe("InsertedTestRun", () => {
describe("DeletedTestRun", () => {
describe("#constructor", () => {
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);
expect(tree).to.deep.equal({
"w:del": [
{
"_attr":
{
_attr: {
"w:author": "Author",
"w:date": "123",
"w:id": 0
}
"w:date": "123",
"w:id": 0,
},
},
{
"w:r": [
{
"w:delText": [
{
"_attr":
{
"xml:space": "preserve"
}
_attr: {
"xml:space": "preserve",
},
},
"some text"
]
}
"some text",
],
},
],
}
]
},
],
});
});
});

View File

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