From 78b8f2604725bc5642538531f8f615b641d3c743 Mon Sep 17 00:00:00 2001 From: Shreya Kamble Date: Wed, 19 Mar 2025 12:12:26 +0530 Subject: [PATCH] feat: hr as a tag not data type --- src/toRedactor.tsx | 2 +- test/expectedJson.ts | 3 ++- test/fromRedactor.test.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/toRedactor.tsx b/src/toRedactor.tsx index ca5abde..9f5ba17 100644 --- a/src/toRedactor.tsx +++ b/src/toRedactor.tsx @@ -105,7 +105,7 @@ const ELEMENT_TYPES: IJsonToHtmlElementTags = { return `${child}` }, hr: (attrs: any, child: any) => { - return `
` + return `
` }, span: (attrs: any, child: any) => { return `${child}` diff --git a/test/expectedJson.ts b/test/expectedJson.ts index a77a1d5..7e4d2d6 100644 --- a/test/expectedJson.ts +++ b/test/expectedJson.ts @@ -618,7 +618,7 @@ export default { "htmlUpdated": "

" }, "7": { - "html": "

this is link

paragraph with class

paragraph with id

", + "html": "

this is link


paragraph with class

paragraph with id

", "json": [ { "type": "p", @@ -660,6 +660,7 @@ export default { }, { "type": "hr", + "attrs": {}, "uid": "699946dbb6b84ef583914eb92dcac44b", "children": [ { diff --git a/test/fromRedactor.test.ts b/test/fromRedactor.test.ts index 8f9c92e..5c1fa63 100644 --- a/test/fromRedactor.test.ts +++ b/test/fromRedactor.test.ts @@ -66,7 +66,7 @@ describe("Testing html to json conversion", () => { let htmlDoc = dom.window.document.querySelector('body') let jsonValue = fromRedactor(htmlDoc) let testResult = isEqual(omitdeep(jsonValue, "uid"), omitdeep(docWrapper(expectedValue[7].json), "uid")) - expect(testResult).toBe(true) + expect(omitdeep(jsonValue, "uid")).toStrictEqual(omitdeep(docWrapper(expectedValue[7].json), "uid")) }) it("Embedded entry as link", () => {