diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index 04cc8af8e4..0b8e9acd00 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -5,8 +5,9 @@ import { stub } from "sinon"; import { Formatter } from "export/formatter"; import { EMPTY_OBJECT } from "file/xml-components"; +import { File } from "../file"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; -import { Bookmark } from "./links"; +import { Bookmark, HyperlinkRef } from "./links"; import { Paragraph } from "./paragraph"; describe("Paragraph", () => { @@ -759,4 +760,23 @@ describe("Paragraph", () => { }); }); }); + + describe("#prepForXml", () => { + it("should set paragraph outline level to the given value", () => { + const paragraph = new Paragraph({ + children: [new HyperlinkRef("myAnchorId")], + }); + const fileMock = ({ + HyperlinkCache: { + myAnchorId: "test", + }, + // tslint:disable-next-line: no-any + } as any) as File; + paragraph.prepForXml(fileMock); + const tree = new Formatter().format(paragraph); + expect(tree).to.deep.equal({ + "w:p": ["test"], + }); + }); + }); });