added #leftTabStop and #maxRightTabStop methods to paragraph styles

This commit is contained in:
felipe
2017-03-12 22:04:57 +01:00
parent 6689f76c28
commit 0b78e33444
2 changed files with 44 additions and 0 deletions

View File

@ -161,6 +161,16 @@ export class ParagraphStyle extends Style {
return this;
}
public maxRightTabStop(): ParagraphStyle {
this.addParagraphProperty(new paragraph.MaxRightTabStop());
return this;
}
public leftTabStop(position: number): ParagraphStyle {
this.addParagraphProperty(new paragraph.LeftTabStop(position));
return this;
}
public indent(left: number, hanging?: number): ParagraphStyle {
this.addParagraphProperty(new paragraph.Indent(left, hanging));
return this;

View File

@ -292,6 +292,40 @@ describe("ParagraphStyle", () => {
],
});
});
it("#leftTabStop", () => {
const style = new ParagraphStyle("myStyleId")
.leftTabStop(1200);
const tree = new Formatter().format(style);
expect(tree).to.deep.equal({
"w:style": [
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
{"w:pPr": [
{"w:tabs": [
{"w:tab": [{_attr: {"w:val": "left", "w:pos": 1200}}]},
]},
]},
{"w:rPr": []},
],
});
});
it("#maxRightTabStop", () => {
const style = new ParagraphStyle("myStyleId")
.maxRightTabStop();
const tree = new Formatter().format(style);
expect(tree).to.deep.equal({
"w:style": [
{_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}},
{"w:pPr": [
{"w:tabs": [
{"w:tab": [{_attr: {"w:val": "right", "w:pos": 9026}}]},
]},
]},
{"w:rPr": []},
],
});
});
});
describe("formatting methods: run properties", () => {