Make Paragraph declaritive

This commit is contained in:
Dolan
2019-06-12 01:03:36 +01:00
parent 5c1a731314
commit cb42c74a8d
33 changed files with 451 additions and 497 deletions

View File

@ -2,7 +2,7 @@
import { assert } from "chai";
import { stub } from "sinon";
import { File, Paragraph } from "file";
import { File, HeadingLevel, Paragraph } from "file";
import { Packer } from "./packer";
@ -17,11 +17,24 @@ describe("Packer", () => {
lastModifiedBy: "Dolan Miu",
});
const paragraph = new Paragraph("test text");
const heading = new Paragraph("Hello world").heading1();
const heading = new Paragraph({
text: "Hello world",
heading: HeadingLevel.HEADING_1,
});
file.addParagraph(new Paragraph("title").title());
file.addParagraph(
new Paragraph({
text: "title",
heading: HeadingLevel.TITLE,
}),
);
file.addParagraph(heading);
file.addParagraph(new Paragraph("heading 2").heading2());
file.addParagraph(
new Paragraph({
text: "heading 2",
heading: HeadingLevel.HEADING_2,
}),
);
file.addParagraph(paragraph);
packer = new Packer();