Change docx folder to more appropriate "file" folder
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import { assert } from "chai";
|
||||
|
||||
import * as docx from "../docx";
|
||||
import { Properties } from "../docx/properties";
|
||||
import { Attributes } from "../docx/xml-components";
|
||||
import { Formatter } from "../export/formatter";
|
||||
import * as file from "../file";
|
||||
import { Properties } from "../file/properties";
|
||||
import { Attributes } from "../file/xml-components";
|
||||
import { Utility } from "../tests/utility";
|
||||
|
||||
describe("Formatter", () => {
|
||||
@ -15,21 +15,21 @@ describe("Formatter", () => {
|
||||
|
||||
describe("#format()", () => {
|
||||
it("should format simple paragraph", () => {
|
||||
const paragraph = new docx.Paragraph();
|
||||
const paragraph = new file.Paragraph();
|
||||
const newJson = formatter.format(paragraph);
|
||||
assert.isDefined(newJson["w:p"]);
|
||||
});
|
||||
|
||||
it("should remove xmlKeys", () => {
|
||||
const paragraph = new docx.Paragraph();
|
||||
const paragraph = new file.Paragraph();
|
||||
const newJson = formatter.format(paragraph);
|
||||
const stringifiedJson = JSON.stringify(newJson);
|
||||
assert(stringifiedJson.indexOf("xmlKeys") < 0);
|
||||
});
|
||||
|
||||
it("should format simple paragraph with bold text", () => {
|
||||
const paragraph = new docx.Paragraph();
|
||||
paragraph.addRun(new docx.TextRun("test").bold());
|
||||
const paragraph = new file.Paragraph();
|
||||
paragraph.addRun(new file.TextRun("test").bold());
|
||||
const newJson = formatter.format(paragraph);
|
||||
assert.isDefined(newJson["w:p"][1]["w:r"][0]["w:rPr"][0]["w:b"][0]._attr["w:val"]);
|
||||
});
|
||||
@ -61,7 +61,7 @@ describe("Formatter", () => {
|
||||
});
|
||||
|
||||
it("should should change 'p' tag into 'w:p' tag", () => {
|
||||
const paragraph = new docx.Paragraph();
|
||||
const paragraph = new file.Paragraph();
|
||||
const newJson = formatter.format(paragraph);
|
||||
assert.isDefined(newJson["w:p"]);
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { BaseXmlComponent } from "../docx/xml-components";
|
||||
import { IXmlableObject } from "../docx/xml-components/xmlable-object";
|
||||
import { BaseXmlComponent } from "../file/xml-components";
|
||||
import { IXmlableObject } from "../file/xml-components/xmlable-object";
|
||||
|
||||
export class Formatter {
|
||||
public format(input: BaseXmlComponent): IXmlableObject {
|
||||
|
@ -4,7 +4,7 @@ import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as xml from "xml";
|
||||
|
||||
import { File } from "../../docx";
|
||||
import { File } from "../../file";
|
||||
import { Formatter } from "../formatter";
|
||||
|
||||
const TEMPLATE_PATH = path.resolve(__dirname, "../../../template");
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as express from "express";
|
||||
|
||||
import { File } from "../../docx";
|
||||
import { File } from "../../file";
|
||||
import { Compiler } from "./compiler";
|
||||
import { IPacker } from "./packer";
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
/* tslint:disable:typedef space-before-function-paren */
|
||||
import * as fs from "fs";
|
||||
|
||||
import { File } from "../../docx";
|
||||
import { Paragraph } from "../../docx/paragraph";
|
||||
import { LocalPacker } from "../../export/packer/local";
|
||||
import { File, Paragraph } from "../../file";
|
||||
|
||||
describe("LocalPacker", () => {
|
||||
let packer: LocalPacker;
|
||||
|
@ -2,7 +2,7 @@ import * as fs from "fs";
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
|
||||
import { File } from "../../docx";
|
||||
import { File } from "../../file";
|
||||
import { Compiler } from "./compiler";
|
||||
import { IPacker } from "./packer";
|
||||
import { PdfConvertWrapper } from "./pdf-convert-wrapper";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { XmlComponent } from "../../docx/xml-components";
|
||||
import { IData } from "../media";
|
||||
import { XmlComponent } from "../xml-components";
|
||||
import { Inline } from "./inline";
|
||||
|
||||
export class Drawing extends XmlComponent {
|
@ -1,4 +1,4 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "../../../../docx/xml-components";
|
||||
import { XmlAttributeComponent, XmlComponent } from "../../../xml-components";
|
||||
import { GraphicData } from "./graphic-data";
|
||||
|
||||
interface IGraphicProperties {
|
@ -1,4 +1,4 @@
|
||||
import { XmlComponent } from "../../../docx/xml-components";
|
||||
import { XmlComponent } from "../../xml-components";
|
||||
import { Graphic } from "./graphic";
|
||||
|
||||
export class Inline extends XmlComponent {
|
@ -1,14 +1,14 @@
|
||||
import { assert, expect } from "chai";
|
||||
|
||||
import * as docx from "../../docx";
|
||||
import { Formatter } from "../../export/formatter";
|
||||
import * as file from "../../file";
|
||||
import { Numbering } from "../numbering";
|
||||
|
||||
describe("Paragraph", () => {
|
||||
let paragraph: docx.Paragraph;
|
||||
let paragraph: file.Paragraph;
|
||||
|
||||
beforeEach(() => {
|
||||
paragraph = new docx.Paragraph();
|
||||
paragraph = new file.Paragraph();
|
||||
});
|
||||
|
||||
describe("#constructor()", () => {
|
||||
@ -35,7 +35,7 @@ describe("Paragraph", () => {
|
||||
describe("#createTextRun", () => {
|
||||
it("should add a new run to the paragraph and return it", () => {
|
||||
const run = paragraph.createTextRun("this is a test run");
|
||||
expect(run).to.be.instanceof(docx.TextRun);
|
||||
expect(run).to.be.instanceof(file.TextRun);
|
||||
const tree = new Formatter().format(paragraph)["w:p"];
|
||||
expect(tree).to.be.an("array").which.includes({
|
||||
"w:r": [
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user