From 8d35dc1bb061563f3bf746beb80a03c13ff82a61 Mon Sep 17 00:00:00 2001 From: Tyler Bell Date: Thu, 17 May 2018 13:32:33 -0600 Subject: [PATCH] Added tests, renamed pagenumber to page-number --- .../title-page/title-page.spec.ts | 17 +++++++++++++++++ .../section-properties/title-page/title-page.ts | 2 +- .../run/{pagenumber.ts => page-number.ts} | 0 src/file/paragraph/run/run.ts | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 src/file/document/body/section-properties/title-page/title-page.spec.ts rename src/file/paragraph/run/{pagenumber.ts => page-number.ts} (100%) diff --git a/src/file/document/body/section-properties/title-page/title-page.spec.ts b/src/file/document/body/section-properties/title-page/title-page.spec.ts new file mode 100644 index 0000000000..75374a22db --- /dev/null +++ b/src/file/document/body/section-properties/title-page/title-page.spec.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { Formatter } from "../../../../../export/formatter"; +import { TitlePage } from "./title-page"; + +describe("PageSize", () => { + describe("#constructor()", () => { + it("should create title page property for different first page header", () => { + const properties = new TitlePage(); + const tree = new Formatter().format(properties); + + expect(Object.keys(tree)).to.deep.equal(["w:titlePg"]); + expect(tree["w:titlePg"]).to.be.an.instanceof(Array); + expect(tree["w:titlePg"][0]).to.deep.equal({ _attr: { "w:val": "1" } }); + }); + }); +}); diff --git a/src/file/document/body/section-properties/title-page/title-page.ts b/src/file/document/body/section-properties/title-page/title-page.ts index 361cc039fa..743c6ee489 100644 --- a/src/file/document/body/section-properties/title-page/title-page.ts +++ b/src/file/document/body/section-properties/title-page/title-page.ts @@ -1,5 +1,5 @@ import { XmlComponent } from "file/xml-components"; -import { TitlePageAttributes } from "./titlepage-attributes"; +import { TitlePageAttributes } from "./title-page-attributes"; export class TitlePage extends XmlComponent { constructor() { diff --git a/src/file/paragraph/run/pagenumber.ts b/src/file/paragraph/run/page-number.ts similarity index 100% rename from src/file/paragraph/run/pagenumber.ts rename to src/file/paragraph/run/page-number.ts diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index 508aad9afa..3123f98cd2 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -8,7 +8,7 @@ import { SubScript, SuperScript } from "./script"; import { Style } from "./style"; import { Tab } from "./tab"; import { Underline } from "./underline"; -import { Begin, Page, End, Separate } from "./pagenumber"; +import { Begin, Page, End, Separate } from "./page-number"; import { XmlComponent } from "file/xml-components";