diff --git a/ts/docx/run/index.ts b/ts/docx/run/index.ts index 12f550dd67..69582fb940 100644 --- a/ts/docx/run/index.ts +++ b/ts/docx/run/index.ts @@ -1,6 +1,6 @@ import {XmlComponent, Attributes} from "../xml-components"; import {RunProperties} from "./properties"; -import {Bold} from "./emphasis"; +import {Bold, Italics, Underline} from "./emphasis"; export class Run implements XmlComponent { protected r: Array; @@ -11,9 +11,19 @@ export class Run implements XmlComponent { this.properties = new RunProperties(); this.r.push(this.properties); } - + bold(): Run { this.properties.push(new Bold()); return this; } + + italics(): Run { + this.properties.push(new Italics()); + return this; + } + + underline(): Run { + this.properties.push(new Underline()); + return this; + } } \ No newline at end of file diff --git a/ts/tests/runTest.ts b/ts/tests/runTest.ts index e30eeb5e52..24e81b693d 100644 --- a/ts/tests/runTest.ts +++ b/ts/tests/runTest.ts @@ -16,10 +16,27 @@ describe('Run', () => { run = new Run(); }); - describe('#constructor()', () => { + describe('#bold()', () => { + it("it should add bold to the properties", () => { + run.bold(); + var newJson = jsonify(run); + assert.isDefined(newJson.r[0].rPr[0].b); + }); + }); - it("", () => { - + describe('#italics()', () => { + it("it should add italics to the properties", () => { + run.italics(); + var newJson = jsonify(run); + assert.isDefined(newJson.r[0].rPr[0].i); + }); + }); + + describe('#underline()', () => { + it("it should add underline to the properties", () => { + run.underline(); + var newJson = jsonify(run); + assert.isDefined(newJson.r[0].rPr[0].u); }); }); });