Server IP : 162.213.251.212 / Your IP : 18.226.52.206 [ Web Server : LiteSpeed System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : allssztx ( 535) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/allssztx/needapair.com/node_modules/docxtemplater/js/tests/e2e/ |
Upload File : |
"use strict"; var _require = require("../utils.js"), createDocV4 = _require.createDocV4, shouldBeSame = _require.shouldBeSame, expect = _require.expect; describe("Docx document properties", function () { it("should change values in doc-props", function () { var doc = createDocV4("tag-docprops.docx", { paragraphLoop: true }); expect(doc.getFullText("docProps/app.xml")).to.be.equal("TitleName: {first_name}"); doc.render({ first_name: "Hipp", last_name: "Edgar", phone: "0652455478", description: "New Website" }); expect(doc.getFullText()).to.be.equal("Edgar Hipp"); expect(doc.getFullText("word/header1.xml")).to.be.equal("Edgar Hipp0652455478New Website"); expect(doc.getFullText("word/footer1.xml")).to.be.equal("EdgarHipp0652455478"); expect(doc.getFullText("docProps/app.xml")).to.be.equal("TitleName: Hipp"); shouldBeSame({ doc: doc, expectedName: "expected-tag-docprops.docx" }); }); it("should change custom values inside '<vt:lpwstr>' in file docProps/custom.xml", function () { return this.render({ name: "tag-docprops-in-doc.docx", data: { first_name: "Hipp", email: "john@acme.com", last_name: "Edgar", phone: "0652455478", description: "New Website" }, expectedName: "expected-tag-docprops-in-doc.docx" }); }); it("should be possible to ignore files in docProps/core.xml", function () { var avoidRenderingCoreXMLModule = { name: "avoidRenderingCoreXMLModule", getFileType: function getFileType(_ref) { var doc = _ref.doc; doc.targets = doc.targets.filter(function (file) { if (file === "docProps/core.xml" || file === "docProps/app.xml") { return false; } return true; }); } }; var doc = createDocV4("core-xml-missing-close-tag.docx", { modules: [avoidRenderingCoreXMLModule] }); doc.render({ first_name: "Hipp", last_name: "Edgar", phone: "0652455478", description: "New Website" }); shouldBeSame({ doc: doc, expectedName: "expected-core-xml.docx" }); }); });