TOC content generation aborted
This commit is contained in:
@ -393,43 +393,4 @@ describe("Paragraph", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#clone", () => {
|
||||
it("changes in a cloned paragraph must not affect the original paragraph", () => {
|
||||
paragraph.pageBreakBefore();
|
||||
|
||||
const tree = new Formatter().format(paragraph);
|
||||
expect(tree).to.deep.equal({ "w:p": [{ "w:pPr": [{ "w:pageBreakBefore": [] }] }] }, "Paragraph with a page break before");
|
||||
|
||||
const clonedParagraph = paragraph.clone();
|
||||
expect(clonedParagraph).to.be.instanceof(file.Paragraph);
|
||||
expect(clonedParagraph.paragraphProperties).to.be.instanceof(file.ParagraphProperties);
|
||||
|
||||
const clonedTree = new Formatter().format(clonedParagraph);
|
||||
expect(clonedTree).to.deep.equal(
|
||||
{
|
||||
"w:p": [{ "w:pPr": [{ "w:pageBreakBefore": [] }] }],
|
||||
},
|
||||
"Cloned Paragraph with page break before",
|
||||
);
|
||||
|
||||
clonedParagraph.clearPageBreaks();
|
||||
|
||||
const clonedTreeAfter = new Formatter().format(clonedParagraph);
|
||||
expect(clonedTreeAfter).to.deep.equal(
|
||||
{
|
||||
"w:p": [{ "w:pPr": [] }],
|
||||
},
|
||||
"Cloned Paragraph after clearPageBreaks must have no properties",
|
||||
);
|
||||
|
||||
const treeAfter = new Formatter().format(paragraph);
|
||||
expect(treeAfter).to.deep.equal(
|
||||
{
|
||||
"w:p": [{ "w:pPr": [{ "w:pageBreakBefore": [] }] }],
|
||||
},
|
||||
"Paragraph after clearPageBreaks in Cloned Paragraph must keep the properties.",
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,4 @@
|
||||
// http://officeopenxml.com/WPparagraph.php
|
||||
import * as cloneDeep from "lodash.clonedeep";
|
||||
|
||||
import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run";
|
||||
import { Image } from "file/media";
|
||||
import { Num } from "file/numbering/num";
|
||||
@ -252,8 +250,4 @@ export class Paragraph extends XmlComponent {
|
||||
this.properties.clearPageBreaks();
|
||||
return this;
|
||||
}
|
||||
|
||||
public clone(): Paragraph {
|
||||
return cloneDeep(this, false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user