added thematic break to paragraph

This commit is contained in:
Dolan Miu
2016-03-29 05:01:33 +01:00
parent e2929bc3a9
commit 4a62975516
2 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import {P, Attributes, ParagraphProperties, Run} from "./xml-components"; import {P, Attributes, ParagraphProperties, Run} from "./xml-components";
import {ThematicBreak} from "./border";
class Style { class Style {
private pStyle: Array<P>; private pStyle: Array<P>;
@ -88,4 +89,9 @@ export class Paragraph {
this.properties.push(new Alignment("both")); this.properties.push(new Alignment("both"));
return this; return this;
} }
pageBreak() {
this.properties.push(new ThematicBreak());
return this;
}
} }

View File

@ -76,4 +76,13 @@ describe('Paragraph', () => {
assert(newJson.p[1].pPr[1].jc[0]._attrs.val === "center"); assert(newJson.p[1].pPr[1].jc[0]._attrs.val === "center");
}); });
}); });
describe("#pageBreak()", () => {
it("should add thematic break to JSON", () => {
paragraph.pageBreak();
var newJson = jsonify(paragraph);
assert.isDefined(newJson.p[1].pPr[1].pBdr);
});
});
}); });