Made project Prettier compliant
This commit is contained in:
@ -8,16 +8,15 @@ describe("Text", () => {
|
||||
it("creates an empty text run if no text is given", () => {
|
||||
const t = new Text("");
|
||||
const f = new Formatter().format(t);
|
||||
expect(f).to.deep.equal({"w:t": [{_attr: {"xml:space": "preserve"}}]});
|
||||
expect(f).to.deep.equal({ "w:t": [{ _attr: { "xml:space": "preserve" } }] });
|
||||
});
|
||||
|
||||
it("adds the passed in text to the component", () => {
|
||||
const t = new Text(" this is\n text");
|
||||
const f = new Formatter().format(t);
|
||||
expect(f).to.deep.equal({"w:t": [
|
||||
{_attr: {"xml:space": "preserve"}},
|
||||
" this is\n text",
|
||||
]});
|
||||
expect(f).to.deep.equal({
|
||||
"w:t": [{ _attr: { "xml:space": "preserve" } }, " this is\n text"],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
class TextAttributes extends XmlAttributeComponent<{space: "default" | "preserve"}> {
|
||||
protected xmlKeys = {space: "xml:space"};
|
||||
class TextAttributes extends XmlAttributeComponent<{ space: "default" | "preserve" }> {
|
||||
protected xmlKeys = { space: "xml:space" };
|
||||
}
|
||||
|
||||
export class Text extends XmlComponent {
|
||||
constructor(text: string) {
|
||||
super("w:t");
|
||||
this.root.push(new TextAttributes({space: "preserve"}));
|
||||
this.root.push(new TextAttributes({ space: "preserve" }));
|
||||
if (text) {
|
||||
this.root.push(text);
|
||||
}
|
||||
|
Reference in New Issue
Block a user