diff --git a/src/file/paragraph/run/page-number.spec.ts b/src/file/paragraph/run/page-number.spec.ts index 4b3c51a8fd..7638f710c2 100644 --- a/src/file/paragraph/run/page-number.spec.ts +++ b/src/file/paragraph/run/page-number.spec.ts @@ -2,11 +2,11 @@ import { describe, expect, it } from "vitest"; import { Formatter } from "@export/formatter"; -import { NumberOfPages, NumberOfPagesSection, Page } from "./page-number"; +import { CurrentSection, NumberOfPages, NumberOfPagesSection, Page } from "./page-number"; describe("Page", () => { describe("#constructor()", () => { - it("uses the font name for both ascii and hAnsi", () => { + it("should work", () => { const tree = new Formatter().format(new Page()); expect(tree).to.deep.equal({ "w:instrText": [{ _attr: { "xml:space": "preserve" } }, "PAGE"] }); }); @@ -15,7 +15,7 @@ describe("Page", () => { describe("NumberOfPages", () => { describe("#constructor()", () => { - it("uses the font name for both ascii and hAnsi", () => { + it("should work", () => { const tree = new Formatter().format(new NumberOfPages()); expect(tree).to.deep.equal({ "w:instrText": [{ _attr: { "xml:space": "preserve" } }, "NUMPAGES"] }); }); @@ -24,9 +24,18 @@ describe("NumberOfPages", () => { describe("NumberOfPagesSection", () => { describe("#constructor()", () => { - it("uses the font name for both ascii and hAnsi", () => { + it("should work", () => { const tree = new Formatter().format(new NumberOfPagesSection()); expect(tree).to.deep.equal({ "w:instrText": [{ _attr: { "xml:space": "preserve" } }, "SECTIONPAGES"] }); }); }); }); + +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"] }); + }); + }); +}); diff --git a/src/file/paragraph/run/page-number.ts b/src/file/paragraph/run/page-number.ts index 210ffc279e..2789b23995 100644 --- a/src/file/paragraph/run/page-number.ts +++ b/src/file/paragraph/run/page-number.ts @@ -27,7 +27,7 @@ export class NumberOfPagesSection extends XmlComponent { } } -export class CurrentPageInSection extends XmlComponent { +export class CurrentSection extends XmlComponent { public constructor() { super("w:instrText"); this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index b4fc429ea6..d3dba0e230 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -6,7 +6,7 @@ import { FieldInstruction } from "@file/table-of-contents/field-instruction"; import { Break } from "./break"; import { Begin, End, Separate } from "./field"; -import { NumberOfPages, NumberOfPagesSection, Page, CurrentPageInSection } from "./page-number"; +import { NumberOfPages, NumberOfPagesSection, Page, CurrentSection } from "./page-number"; import { IRunPropertiesOptions, RunProperties } from "./properties"; import { Text } from "./run-components/text"; import { @@ -146,7 +146,7 @@ export class Run extends XmlComponent { break; case PageNumber.CURRENT_SECTION: this.root.push(new Begin()); - this.root.push(new CurrentPageInSection()); + this.root.push(new CurrentSection()); this.root.push(new Separate()); this.root.push(new End()); break;