2016-07-01 22:09:55 +01:00
|
|
|
/// <reference path="../../typings/mocha/mocha.d.ts" />
|
|
|
|
/// <reference path="../../typings/chai/chai.d.ts" />
|
|
|
|
/// <reference path="../../typings/archiver/archiver.d.ts" />
|
|
|
|
/// <reference path="../../typings/xml/xml.d.ts" />
|
2016-03-31 18:07:22 +01:00
|
|
|
|
2016-07-01 22:09:55 +01:00
|
|
|
import {LocalPacker} from "../../export/packer/local";
|
2016-03-31 18:03:16 +01:00
|
|
|
import {assert} from "chai";
|
2016-07-01 22:09:55 +01:00
|
|
|
import {Document} from "../../docx/document";
|
|
|
|
import {Properties} from "../../properties";
|
|
|
|
import {DefaultStyle} from "../../styles/sample";
|
|
|
|
import {Paragraph} from "../../docx/paragraph";
|
|
|
|
import {DefaultStylesFactory} from "../../styles/factory";
|
2016-03-31 18:03:16 +01:00
|
|
|
|
2016-07-01 22:09:55 +01:00
|
|
|
describe("Packer", () => {
|
2016-05-26 15:08:34 +01:00
|
|
|
let packer: LocalPacker;
|
|
|
|
let stylesFactory: DefaultStylesFactory;
|
2016-03-31 18:03:16 +01:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2016-05-26 15:08:34 +01:00
|
|
|
let document = new Document();
|
|
|
|
let paragraph = new Paragraph("test text");
|
|
|
|
let heading = new Paragraph("Hello world").heading1();
|
2016-05-10 00:32:00 +01:00
|
|
|
document.addParagraph(new Paragraph("title").title());
|
2016-05-09 03:44:16 +01:00
|
|
|
document.addParagraph(heading);
|
2016-05-10 00:32:00 +01:00
|
|
|
document.addParagraph(new Paragraph("heading 2").heading2());
|
2016-04-05 22:11:21 +01:00
|
|
|
document.addParagraph(paragraph);
|
2016-05-26 15:08:34 +01:00
|
|
|
let properties = new Properties({
|
2016-07-19 18:45:07 +01:00
|
|
|
creator: "Dolan Miu",
|
2016-04-08 23:01:50 +01:00
|
|
|
revision: "1",
|
2016-07-19 18:45:07 +01:00
|
|
|
lastModifiedBy: "Dolan Miu"
|
2016-04-05 01:49:12 +01:00
|
|
|
});
|
2016-05-09 03:44:16 +01:00
|
|
|
stylesFactory = new DefaultStylesFactory();
|
2016-07-04 18:47:13 +01:00
|
|
|
packer = new LocalPacker(document, stylesFactory.newInstance(), properties);
|
2016-03-31 18:03:16 +01:00
|
|
|
});
|
|
|
|
|
2016-05-26 15:08:34 +01:00
|
|
|
describe("#pack()", () => {
|
2016-07-01 22:09:55 +01:00
|
|
|
it("should create a standard docx file", function (done) {
|
|
|
|
this.timeout(99999999);
|
2016-07-04 18:47:13 +01:00
|
|
|
packer.pack("build/tests/test.docx");
|
2016-04-09 04:53:42 +01:00
|
|
|
setTimeout(done, 1900);
|
2016-03-31 18:03:16 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|