2021-11-30 21:11:06 +09:00
|
|
|
import { expect } from "chai";
|
|
|
|
|
2022-06-26 23:26:42 +01:00
|
|
|
import { Formatter } from "@export/formatter";
|
2021-11-30 21:11:06 +09:00
|
|
|
|
|
|
|
import { DocumentGrid, DocumentGridType } from ".";
|
|
|
|
|
|
|
|
describe("DocumentGrid", () => {
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create documentGrid with specified linePitch", () => {
|
|
|
|
const docGrid = new DocumentGrid(360);
|
|
|
|
const tree = new Formatter().format(docGrid);
|
|
|
|
|
|
|
|
expect(tree["w:docGrid"]).to.deep.equal({ _attr: { "w:linePitch": 360 } });
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create documentGrid with specified linePitch and type", () => {
|
|
|
|
const docGrid = new DocumentGrid(360, undefined, DocumentGridType.LINES);
|
|
|
|
const tree = new Formatter().format(docGrid);
|
|
|
|
|
|
|
|
expect(tree["w:docGrid"]).to.deep.equal({ _attr: { "w:linePitch": 360, "w:type": "lines" } });
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should create documentGrid with specified linePitch,charSpace and type", () => {
|
|
|
|
const docGrid = new DocumentGrid(346, -1541, DocumentGridType.LINES_AND_CHARS);
|
|
|
|
const tree = new Formatter().format(docGrid);
|
|
|
|
|
|
|
|
expect(tree["w:docGrid"]).to.deep.equal({ _attr: { "w:linePitch": 346, "w:charSpace": -1541, "w:type": "linesAndChars" } });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|