Remove unused code and improve coverage
This commit is contained in:
@ -4,10 +4,6 @@ import * as shortid from "shortid";
|
||||
import { TextRun } from "../run";
|
||||
import { BookmarkEndAttributes, BookmarkStartAttributes } from "./bookmark-attributes";
|
||||
|
||||
export class BookmarkRef {
|
||||
constructor(public readonly name: string, public readonly text: string) {}
|
||||
}
|
||||
|
||||
export class Bookmark {
|
||||
public readonly start: BookmarkStart;
|
||||
public readonly text: TextRun;
|
||||
|
@ -3,6 +3,7 @@ import { expect } from "chai";
|
||||
import { Formatter } from "export/formatter";
|
||||
|
||||
import { Hyperlink } from "./";
|
||||
import { HyperlinkRef } from "./hyperlink";
|
||||
|
||||
describe("Hyperlink", () => {
|
||||
let hyperlink: Hyperlink;
|
||||
@ -59,3 +60,11 @@ describe("Hyperlink", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("HyperlinkRef", () => {
|
||||
describe("#constructor()", () => {
|
||||
const hyperlinkRef = new HyperlinkRef("test-id");
|
||||
|
||||
expect(hyperlinkRef.id).to.equal("test-id");
|
||||
});
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ import { ContextualSpacing, ISpacingProperties, Spacing } from "./formatting/spa
|
||||
import { HeadingLevel, Style } from "./formatting/style";
|
||||
import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop";
|
||||
import { NumberProperties } from "./formatting/unordered-list";
|
||||
import { Bookmark, BookmarkRef, HyperlinkRef, OutlineLevel } from "./links";
|
||||
import { Bookmark, HyperlinkRef, OutlineLevel } from "./links";
|
||||
import { ParagraphProperties } from "./properties";
|
||||
import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run";
|
||||
|
||||
@ -46,7 +46,7 @@ export interface IParagraphOptions {
|
||||
readonly custom?: boolean;
|
||||
};
|
||||
readonly children?: Array<
|
||||
TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef | BookmarkRef
|
||||
TextRun | PictureRun | SymbolRun | Bookmark | PageBreak | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef
|
||||
>;
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,6 @@ export class PictureRun extends Run {
|
||||
constructor(imageData: IMediaData, drawingOptions?: IDrawingOptions) {
|
||||
super({});
|
||||
|
||||
if (imageData === undefined) {
|
||||
throw new Error("imageData cannot be undefined");
|
||||
}
|
||||
|
||||
const drawing = new Drawing(imageData, drawingOptions);
|
||||
|
||||
this.root.push(drawing);
|
||||
|
@ -132,6 +132,30 @@ describe("Run", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#subScript()", () => {
|
||||
it("it should add subScript to the properties", () => {
|
||||
const run = new Run({
|
||||
subScript: true,
|
||||
});
|
||||
const tree = new Formatter().format(run);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:r": [{ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "subscript" } } }] }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#superScript()", () => {
|
||||
it("it should add superScript to the properties", () => {
|
||||
const run = new Run({
|
||||
superScript: true,
|
||||
});
|
||||
const tree = new Formatter().format(run);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:r": [{ "w:rPr": [{ "w:vertAlign": { _attr: { "w:val": "superscript" } } }] }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#highlight()", () => {
|
||||
it("it should add highlight to the properties", () => {
|
||||
const run = new Run({
|
||||
|
Reference in New Issue
Block a user