Files
docx-js/src/file/paragraph/run/page-number.spec.ts

42 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-06-05 00:33:43 +01:00
import { describe, expect, it } from "vitest";
2019-01-15 21:40:19 +00:00
import { Formatter } from "@export/formatter";
2019-01-15 21:40:19 +00:00
2023-12-29 23:52:43 +00:00
import { CurrentSection, NumberOfPages, NumberOfPagesSection, Page } from "./page-number";
2019-01-15 21:40:19 +00:00
describe("Page", () => {
describe("#constructor()", () => {
2023-12-29 23:52:43 +00:00
it("should work", () => {
2019-01-15 21:40:19 +00:00
const tree = new Formatter().format(new Page());
expect(tree).to.deep.equal({ "w:instrText": [{ _attr: { "xml:space": "preserve" } }, "PAGE"] });
});
});
});
describe("NumberOfPages", () => {
describe("#constructor()", () => {
2023-12-29 23:52:43 +00:00
it("should work", () => {
2019-01-15 21:40:19 +00:00
const tree = new Formatter().format(new NumberOfPages());
expect(tree).to.deep.equal({ "w:instrText": [{ _attr: { "xml:space": "preserve" } }, "NUMPAGES"] });
});
});
});
2019-08-09 11:56:22 +03:00
describe("NumberOfPagesSection", () => {
describe("#constructor()", () => {
2023-12-29 23:52:43 +00:00
it("should work", () => {
2019-08-09 11:56:22 +03:00
const tree = new Formatter().format(new NumberOfPagesSection());
expect(tree).to.deep.equal({ "w:instrText": [{ _attr: { "xml:space": "preserve" } }, "SECTIONPAGES"] });
});
});
});
2023-12-29 23:52:43 +00:00
describe("CurrentSection", () => {
describe("#constructor()", () => {
it("should work", () => {
const tree = new Formatter().format(new CurrentSection());
expect(tree).to.deep.equal({ "w:instrText": [{ _attr: { "xml:space": "preserve" } }, "SECTION"] });
});
});
});