added #strike and #doubleStrike methods to paragraphStyle

This commit is contained in:
felipe
2017-03-12 17:44:42 +01:00
parent 9a90818729
commit 371398bc2c
2 changed files with 40 additions and 0 deletions

View File

@ -101,6 +101,16 @@ export class ParagraphStyle extends Style {
return this;
}
public strike(): ParagraphStyle {
this.addRunProperty(new formatting.Strike());
return this;
}
public doubleStrike(): ParagraphStyle {
this.addRunProperty(new formatting.DoubleStrike());
return this;
}
public underline(underlineType?: string, color?: string): ParagraphStyle {
this.addRunProperty(new formatting.Underline(underlineType, color));
return this;

View File

@ -260,6 +260,36 @@ describe("ParagraphStyle", () => {
});
});
it("#strike", () => {
const style = new ParagraphStyle("myStyleId")
.strike();
const tree = new Formatter().format(style);
expect(tree).to.deep.equal({
"w:style": [
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
{"w:pPr": []},
{"w:rPr": [
{"w:strike": [{_attr: {"w:val": true}}]},
]},
],
});
});
it("#doubleStrike", () => {
const style = new ParagraphStyle("myStyleId")
.doubleStrike();
const tree = new Formatter().format(style);
expect(tree).to.deep.equal({
"w:style": [
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
{"w:pPr": []},
{"w:rPr": [
{"w:dstrike": [{_attr: {"w:val": true}}]},
]},
],
});
});
it("#bold", () => {
const style = new ParagraphStyle("myStyleId")
.bold();