* Add hyphenation support * Remove unneeded linebreaks * Add documentation and fix eslint * Add tests --------- Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { Formatter } from "@export/formatter";
|
|
|
|
import { createLineNumberType } from "./line-number";
|
|
|
|
describe("createLineNumberType", () => {
|
|
it("should work", () => {
|
|
const textDirection = createLineNumberType({ countBy: 0, start: 0, restart: "newPage", distance: 10 });
|
|
|
|
const tree = new Formatter().format(textDirection);
|
|
expect(tree).to.deep.equal({
|
|
"w:lnNumType": { _attr: { "w:countBy": 0, "w:start": 0, "w:restart": "newPage", "w:distance": 10 } },
|
|
});
|
|
});
|
|
|
|
it("should work with string measures for distance", () => {
|
|
const textDirection = createLineNumberType({ countBy: 0, start: 0, restart: "newPage", distance: "10mm" });
|
|
|
|
const tree = new Formatter().format(textDirection);
|
|
expect(tree).to.deep.equal({
|
|
"w:lnNumType": { _attr: { "w:countBy": 0, "w:start": 0, "w:restart": "newPage", "w:distance": "10mm" } },
|
|
});
|
|
});
|
|
|
|
it("should work with blank entries", () => {
|
|
const textDirection = createLineNumberType({});
|
|
|
|
const tree = new Formatter().format(textDirection);
|
|
expect(tree).to.deep.equal({
|
|
"w:lnNumType": { _attr: {} },
|
|
});
|
|
});
|
|
});
|