/* * (c) Copyright Ascensio System SIA 2010-2025 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish * street, Riga, Latvia, EU, LV-1050. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ "use strict"; $(function () { QUnit.module("Word Copy Paste Tests"); let logicDocument = AscTest.CreateLogicDocument(); AscTest.Editor.WordControl.m_oDrawingDocument.m_oLogicDocument = logicDocument; AscTest.Editor.WordControl.m_oLogicDocument = logicDocument; const charWidth = AscTest.CharWidth * AscTest.FontSize; const L_FIELD = 20 * charWidth; const R_FIELD = 30 * charWidth; const PAGE_W = 150 * charWidth; function initDocument() { AscTest.ClearDocument(); logicDocument.AddToContent(0, AscTest.CreateParagraph()); let sectPr = AscTest.GetFinalSection(); sectPr.SetPageSize(PAGE_W, 1000); sectPr.SetPageMargins(L_FIELD, 50, R_FIELD, 50); } QUnit.test("Test: \"callback tests paste plain text\"", function (assert) { let done = assert.async(); AscTest.Editor.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text, "test", undefined, undefined, undefined, function (success) { assert.ok(success); done(); }); }); QUnit.test("Test: \"callback tests paste HTML\"", function (assert) { let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "test HTML content"; AscTest.Editor.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function (success) { assert.ok(success); done(); }); }); QUnit.test("Test: \"callback tests paste Internal format\"", function (assert) { let done = assert.async(); let binaryData = ""; AscTest.Editor.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Internal, binaryData, undefined, undefined, undefined, function () { assert.ok(true); done(); }); }); QUnit.test('Test: "copy sdt email address HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); // Create an HTML element to simulate copying let htmlElement = document.createElement("div"); htmlElement.innerHTML = "\n" + " \n" + " \n" + " user111@example.com\n" + " \n" + "\n"; // Simulate pasting the HTML content into the document AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": " user111@example.com \r\n", "content": [ { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "sdtPr": { "alias": "Email Address", "appearance": "boundingBox", "equation": false, "id": "1837335015", "picture": false, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": false, "tag": "EmailTag", "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ " user111@example.com " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt checkbox form HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "

\n" + " \n" + " \n" + " \n" + "

\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": "☐ \r\n\r\n", "content": [ { "bFromDocument": true, "pPr": { "pBdr": { "bottom": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "left": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "right": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "top": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" } }, "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "sdtPr": { "alias": "Title", "appearance": "boundingBox", "equation": false, "id": "-1395741881", "picture": false, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": false, "tag": "Tag", "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ "☐ " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" }, { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt combobox form HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "\n" + " \n" + " test\n" + " \n" + "\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": "test \r\n", "content": [ { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "sdtPr": { "alias": "Title", "appearance": "boundingBox", "comboBox": { "listItem": [], "lastValue": -1 }, "equation": false, "id": "1837335014", "picture": false, "placeholder": { "docPart": "DefaultPlaceholder_LIST" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": true, "tag": "Tag", "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ "test " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt text inline form HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "\n" + " \n" + " inline\n" + " \n" + "\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": " inline \r\n", "content": [ { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "sdtPr": { "alias": "Title", "appearance": "boundingBox", "equation": false, "id": "1837335014", "picture": false, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": false, "tag": "Tag", "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ " inline " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt radio button form HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "

\n" + " Choice 1\n" + "

\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": "Choice 1\r\n\r\n", "content": [ { "bFromDocument": true, "pPr": { "pBdr": { "bottom": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "left": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "right": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "top": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" } }, "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "sdtPr": { "appearance": "boundingBox", "equation": false, "id": "123456789", "lock": "sdtContentLocked", "picture": false, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": false, "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ "Choice 1" ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" }, { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt date picker form HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "\n" + " 24.10.2022\n" + "\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": "24.10.2022\r\n", "content": [ { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "sdtPr": { "alias": "Date Picker", "appearance": "boundingBox", "date": { "calendar": "gregorian", "dateFormat": "dd.MM.yyyy", "lid": "en-US", "fullDate": "2022-10-24T00:00:00Z" }, "equation": false, "id": "-291673853", "picture": false, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": false, "tag": "DateTag", "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ "24.10.2022" ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt complex form HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "

\n" + " \n" + " Complex form content\n" + " \n" + "

\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument).replace(/"docPart":"[^"]*"/g, '"docPart":""'); const expected = { "type": "document", "textPr": " Complex form content \r\n\r\n", "content": [ { "bFromDocument": true, "pPr": { "pBdr": { "bottom": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "left": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "right": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "top": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" } }, "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "sdtPr": { "appearance": "boundingBox", "equation": false, "id": "123456789", "lock": "sdtContentLocked", "picture": false, "placeholder": { "docPart": "" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": true, "tag": "tag", "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ " Complex form content " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" }, { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt text form with mask HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "\n" + " \n" + " \n" + " 1234-5678-9012-3456\n" + " \n" + "\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument).replace(/"docPart":"[^"]*"/g, '"docPart":""');; const expected = { "type": "document", "textPr": " 1234-5678-9012-3456 \r\n", "content": [ { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "sdtPr": { "appearance": "boundingBox", "equation": false, "id": "1837335025", "picture": false, "placeholder": { "docPart": "" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": true, "tag": "CreditCardTag", "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ " 1234-5678-9012-3456 " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt plain text HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "\n" + " \n" + " \n" + " Plain text\n" + " \n" + "\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": " Plain text \r\n", "content": [ { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "sdtPr": { "appearance": "boundingBox", "equation": false, "id": "-818574957", "picture": false, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": false, "temporary": false }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ " Plain text " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" } ], "type": "inlineLvlSdt" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); QUnit.test('Test: "copy sdt rich text block level HTML with JSON verification"', function (assert) { initDocument(); let done = assert.async(); let htmlElement = document.createElement("div"); htmlElement.innerHTML = "\n" + "

Rich plain text\n" + " \n" + " \n" + "

\n" + "
\n"; AscTest.Editor.asc_PasteData( AscCommon.c_oAscClipboardDataFormat.HtmlElement, htmlElement, undefined, undefined, undefined, function () {} ); const result = ToJsonString(logicDocument); const expected = { "type": "document", "textPr": "\r\nRich plain text \r\n\r\n", "content": [ { "bFromDocument": true, "pPr": { "pBdr": { "bottom": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "left": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "right": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "top": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" } }, "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" }, { "sdtPr": { "appearance": "boundingBox", "equation": false, "id": "819472493", "picture": false, "rPr": { "bFromDocument": true, "type": "textPr" }, "showingPlcHdr": false, "temporary": false }, "sdtContent": { "bPresentation": false, "content": [ { "bFromDocument": true, "pPr": { "pBdr": { "bottom": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "left": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "right": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" }, "top": { "color": { "auto": false, "r": 0, "g": 0, "b": 0 }, "sz": 4, "space": 0, "value": "none" } }, "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ "Rich plain text " ], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "run" }, { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ], "type": "docContent" }, "type": "blockLvlSdt" }, { "bFromDocument": true, "pPr": { "bFromDocument": true, "type": "paraPr" }, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [ { "bFromDocument": true, "rPr": { "bFromDocument": true, "type": "textPr" }, "content": [], "footnotes": [], "endnotes": [], "reviewType": "common", "type": "endRun" } ], "changes": [], "type": "paragraph" } ] }; assert.strictEqual( result, JSON.stringify(expected), "HTML content should match expected JSON format" ); done(); }); function ToJsonString(logicDocument) { var oWriter = new AscJsonConverter.WriterToJSON(); var oResult = { type: "document", textPr: logicDocument.GetText(), content: oWriter.SerContent( logicDocument.Content, undefined, undefined, undefined, true ), // "paraPr": bWriteDefaultParaPr ? oWriter.SerParaPr(this.GetDefaultParaPr().ParaPr) : undefined, // "theme": bWriteTheme ? oWriter.SerTheme(this.Document.GetTheme()) : undefined, // "sectPr": bWriteSectionPr ? oWriter.SerSectionPr(this.Document.SectPr) : undefined, // "numbering": bWriteNumberings ? oWriter.jsonWordNumberings : undefined, // "styles": bWriteStyles ? oWriter.SerWordStylesForWrite() : undefined }; return JSON.stringify(oResult); } QUnit.module("Word Copy Paste Tests"); });