2023-06-05 00:33:43 +01:00
|
|
|
import { describe, expect, it } from "vitest";
|
2021-11-30 21:11:06 +09:00
|
|
|
|
2022-06-26 23:26:42 +01:00
|
|
|
import { Formatter } from "@export/formatter";
|
2021-11-30 21:11:06 +09:00
|
|
|
|
2025-04-14 16:43:15 +05:30
|
|
|
import { DocumentGridType, createDocumentGrid } from ".";
|
2021-11-30 21:11:06 +09:00
|
|
|
|
2025-04-14 16:43:15 +05:30
|
|
|
describe("createDocumentGrid", () => {
|
2021-11-30 21:11:06 +09:00
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create documentGrid with specified linePitch", () => {
|
2025-04-14 16:43:15 +05:30
|
|
|
const docGrid = createDocumentGrid({ linePitch: 360 });
|
2021-11-30 21:11:06 +09:00
|
|
|
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", () => {
|
2025-04-14 16:43:15 +05:30
|
|
|
const docGrid = createDocumentGrid({ linePitch: 360, type: DocumentGridType.LINES });
|
2021-11-30 21:11:06 +09:00
|
|
|
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", () => {
|
2025-04-14 16:43:15 +05:30
|
|
|
const docGrid = createDocumentGrid({ linePitch: 346, charSpace: -1541, type: DocumentGridType.LINES_AND_CHARS });
|
2021-11-30 21:11:06 +09:00
|
|
|
const tree = new Formatter().format(docGrid);
|
|
|
|
|
|
|
|
expect(tree["w:docGrid"]).to.deep.equal({ _attr: { "w:linePitch": 346, "w:charSpace": -1541, "w:type": "linesAndChars" } });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|