Files
docx-js/src/file/document/body/section-properties/properties/doc-grid.spec.ts
Dolan 4d1a351649 Documentation and Refactoring (#3028)
* Documentation and Refactoring

* Documentation and Refactoring

* Fix lint issues

* Convert components to Builder style

---------

Co-authored-by: Dolan Miu <dmiu@bloomberg.net>
2025-04-14 16:43:15 +05:30

31 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { DocumentGridType, createDocumentGrid } from ".";
describe("createDocumentGrid", () => {
describe("#constructor()", () => {
it("should create documentGrid with specified linePitch", () => {
const docGrid = createDocumentGrid({ linePitch: 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 = createDocumentGrid({ linePitch: 360, type: 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 = createDocumentGrid({ linePitch: 346, charSpace: -1541, type: 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" } });
});
});
});