named this addRun because I realised Text can be a Run, but also a Picture can be a run

This commit is contained in:
Dolan
2017-03-13 23:35:24 +00:00
parent e7e6d02cc5
commit 486777b108
2 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import { Num } from "../../numbering/num";
import { Run } from "../run";
import { TextRun } from "../run/text-run";
import { XmlComponent } from "../xml-components";
@ -24,14 +25,14 @@ export class Paragraph extends XmlComponent {
}
}
public addText(run: TextRun): Paragraph {
public addRun(run: Run): Paragraph {
this.root.push(run);
return this;
}
public createTextRun(text: string): TextRun {
const run = new TextRun(text);
this.addText(run);
this.addRun(run);
return run;
}

View File

@ -29,7 +29,7 @@ describe("Formatter", () => {
it("should format simple paragraph with bold text", () => {
const paragraph = new docx.Paragraph();
paragraph.addText(new docx.TextRun("test").bold());
paragraph.addRun(new docx.TextRun("test").bold());
const newJson = formatter.format(paragraph);
assert.isDefined(newJson["w:p"][1]["w:r"][0]["w:rPr"][0]["w:b"][0]._attr["w:val"]);
});