Merge branch 'master' into feat/deprecate-shelljs
# Conflicts: # src/file/numbering/numbering.ts
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
import { assert, expect } from "chai";
|
||||
import { SinonStub, stub } from "sinon";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
import * as convenienceFunctions from "@util/convenience-functions";
|
||||
|
||||
import { Utility } from "tests/utility";
|
||||
|
||||
@ -40,14 +38,6 @@ const createAnchor = (drawingOptions: IDrawingOptions): Anchor =>
|
||||
);
|
||||
|
||||
describe("Anchor", () => {
|
||||
before(() => {
|
||||
stub(convenienceFunctions, "docPropertiesUniqueNumericId").callsFake(() => 0);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
(convenienceFunctions.docPropertiesUniqueNumericId as SinonStub).restore();
|
||||
});
|
||||
|
||||
let anchor: Anchor;
|
||||
|
||||
describe("#constructor()", () => {
|
||||
@ -466,7 +456,7 @@ describe("Anchor", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "test",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "test",
|
||||
title: "test",
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { ConcreteHyperlink } from "@file/paragraph";
|
||||
|
||||
import { docPropertiesUniqueNumericId } from "@util/convenience-functions";
|
||||
import { docPropertiesUniqueNumericIdGen } from "@util/convenience-functions";
|
||||
|
||||
import { createHyperlinkClick } from "./doc-properties-children";
|
||||
|
||||
@ -25,6 +25,8 @@ export interface DocPropertiesOptions {
|
||||
}
|
||||
|
||||
export class DocProperties extends XmlComponent {
|
||||
private readonly docPropertiesUniqueNumericId = docPropertiesUniqueNumericIdGen();
|
||||
|
||||
public constructor({ name, description, title }: DocPropertiesOptions = { name: "", description: "", title: "" }) {
|
||||
super("wp:docPr");
|
||||
|
||||
@ -32,7 +34,7 @@ export class DocProperties extends XmlComponent {
|
||||
new NextAttributeComponent({
|
||||
id: {
|
||||
key: "id",
|
||||
value: docPropertiesUniqueNumericId(),
|
||||
value: this.docPropertiesUniqueNumericId(),
|
||||
},
|
||||
name: {
|
||||
key: "name",
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { expect } from "chai";
|
||||
import { SinonStub, stub } from "sinon";
|
||||
|
||||
import { IContext } from "@file/xml-components";
|
||||
import { Formatter } from "@export/formatter";
|
||||
import * as convenienceFunctions from "@util/convenience-functions";
|
||||
|
||||
import { ConcreteHyperlink, TextRun } from "../";
|
||||
import { Drawing, IDrawingOptions } from "./drawing";
|
||||
@ -30,14 +28,6 @@ const createDrawing = (drawingOptions?: IDrawingOptions): Drawing =>
|
||||
);
|
||||
|
||||
describe("Drawing", () => {
|
||||
before(() => {
|
||||
stub(convenienceFunctions, "docPropertiesUniqueNumericId").callsFake(() => 0);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
(convenienceFunctions.docPropertiesUniqueNumericId as SinonStub).restore();
|
||||
});
|
||||
|
||||
let currentBreak: Drawing;
|
||||
|
||||
describe("#constructor()", () => {
|
||||
@ -78,7 +68,7 @@ describe("Drawing", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
@ -309,7 +299,7 @@ describe("Drawing", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
@ -543,7 +533,7 @@ describe("Drawing", () => {
|
||||
{
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
|
Reference in New Issue
Block a user