Skip to content

fix: class to class-name changed #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __test__/gql/gql-json-to-html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ describe('Node parser reference content', () => {

GQL.jsonToHTML({entry, paths})

expect(entry[0].single_rte).toEqual('<a href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>')
expect(entry[0].multiple_rte).toEqual(['<a href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>'])
expect(entry[0].single_rte).toEqual('<a class=\"embedded-entry\" href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>')
expect(entry[0].multiple_rte).toEqual(['<a class=\"embedded-entry\" href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>'])
done()
})

Expand Down
4 changes: 2 additions & 2 deletions __test__/mock/json-element-mock-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const plainTextHtmlWithId = "<p class=\"class_p\"><em><u><span id=\"blue\">data<
const htmlTextIdInAttrs = "<p id=\"id_p\"><em><u>data</u></em></p>"
const classAndIdAttrsHtml = "<a class=\"class_a\" id=\"id_p\" href=\"LINK.com\">link</a><img class=\"class_img\" id=\"id_img\" src=\"https://dummyImage.url/Donald.jog.png\" /><h1 class=\"class_h1\" id=\"id_h1\">heading1</h1><h2 class=\"class_h2\" id=\"id_h2\">heading2</h2><h3 class=\"class_h3\" id=\"id_h3\">heading3</h3><h4 class=\"class_h4\" id=\"id_h4\">heading4</h4><h5 class=\"class_h5\" id=\"id_h5\">heading5</h5><h6 class=\"class_h6\" id=\"id_h6\">heading6</h6>"
const styleObjHtml = "<h1 style=\"text-align:justify;\">heading1</h1><h2 style=\"text-align:left;\">heading2</h2><h3 style=\"text-align:right;\">heading3</h3><h4 style=\"text-align:justify;\">heading4</h4><h5 style=\"text-align:justify;\">heading5</h5><h6 style=\"text-align:justify;\">heading6</h6>"
const referenceObjHtml = "<p><a href=\"/test\" target=\"_self\">Embed entry as a link</a></p><p><a href=\"/entry-3\" target=\"_blank\">Open entry as a link in new tab</a></p><p><a href=\"/entry-2\" target=\"_self\">Bold entry</a></p><p><a href=\"/entry-4\" target=\"_blank\"><strong>Bold entry open in new tab</strong></a></p>"
const referenceObjHtmlBlock = "<p><a href=\"/Test\" target=\"_self\">Embed entry as a link</a></p><p><a href=\"undefined\" target=\"_blank\">Embed entry as a link open in new tab</a></p><ul><li><a href=\"undefined\" target=\"_self\">Entry as a link</a></li><li><a href=\"undefined\" target=\"_blank\">Open entry as a link in new tab</a></li><li><a href=\"undefined\" target=\"_self\"><strong><u>Entry as a link bold</u></strong></a></li><li><a href=\"khjgf\" target=\"_blank\"><strong><u>Open bold entry as a link in new tab </u></strong></a></li><li><a href=\"https://\" target=\"_self\"><strong><u>Link URL</u></strong></a></li><li><a href=\"https://\" target=\"_blank\"><strong><u>Open link in new tab</u></strong></a></li></ul>"
const referenceObjHtml = "<p><a class=\"embedded-entry redactor-component block-entry\" href=\"/test\" target=\"_self\">Embed entry as a link</a></p><p><a class=\"embedded-entry redactor-component block-entry\" href=\"/entry-3\" target=\"_blank\">Open entry as a link in new tab</a></p><p><a class=\"embedded-entry redactor-component block-entry\" href=\"/entry-2\" target=\"_self\">Bold entry</a></p><p><a class=\"embedded-entry redactor-component block-entry\" href=\"/entry-4\" target=\"_blank\"><strong>Bold entry open in new tab</strong></a></p>"
const referenceObjHtmlBlock = "<p><a class=\"embedded-entry redactor-component block-entry\" href=\"/Test\" target=\"_self\">Embed entry as a link</a></p><p><a class=\"embedded-entry redactor-component block-entry\" href=\"undefined\" target=\"_blank\">Embed entry as a link open in new tab</a></p><ul><li><a class=\"embedded-entry redactor-component block-entry\" href=\"undefined\" target=\"_self\">Entry as a link</a></li><li><a class=\"embedded-entry redactor-component block-entry\" href=\"undefined\" target=\"_blank\">Open entry as a link in new tab</a></li><li><a class=\"embedded-entry redactor-component block-entry\" href=\"undefined\" target=\"_self\"><strong><u>Entry as a link bold</u></strong></a></li><li><a class=\"embedded-entry redactor-component block-entry\" href=\"khjgf\" target=\"_blank\"><strong><u>Open bold entry as a link in new tab </u></strong></a></li><li><a href=\"https://\" target=\"_self\"><strong><u>Link URL</u></strong></a></li><li><a href=\"https://\" target=\"_blank\"><strong><u>Open link in new tab</u></strong></a></li></ul>"
export {
h1Html,
h2Html,
Expand Down
38 changes: 19 additions & 19 deletions __test__/mock/json-element-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const orderListJson = {
"style": {
"text-align": "justify"
},
"class": "class",
"class-name": "class",
"redactor-attributes": {}
},
"uid": "160bbd7430b98bd3d996",
Expand Down Expand Up @@ -261,7 +261,7 @@ const orderListJson = {
}
],
"id": "7f413d448a",
"attrs": {class: "table", id: "table_id"}
"attrs": {"class-name": "table", "id": "table_id"}
}
],
type: "doc"
Expand Down Expand Up @@ -582,7 +582,7 @@ const unorderListJson = {
}
],
"id": "b083fa46ef899420ab19",
"attrs": {class: "table", id: "table_id"}
"attrs": {"class-name": "table", id: "table_id"}
}
],
type: "doc"
Expand Down Expand Up @@ -719,7 +719,7 @@ const tableJson = {
"uid": "b9082",
"type": "thead",
"attrs": {
"class": "class"
"class-name": "class"
},
"children": [
{
Expand Down Expand Up @@ -768,14 +768,14 @@ const tableJson = {
{
"type": "tbody",
"attrs": {
"class": "class",
"class-name": "class",
"id":"id"
},
"children": [
{
"type": "tr",
"attrs": {
"class": "class",
"class-name": "class",
"id":"id"},
"children": [
{
Expand All @@ -798,7 +798,7 @@ const tableJson = {
{
"type": "td",
"attrs": {
"class": "class",
"class-name": "class",
"id":"id"},
"children": [
{
Expand Down Expand Up @@ -847,7 +847,7 @@ const tableJson = {
{
"type": "p",
"attrs": {
"class": "class"
"class-name": "class"
},
"children": [
{
Expand Down Expand Up @@ -996,7 +996,7 @@ const styleinPJson = {
attrs: {
url: 'example.com',
target: '_blank',
"class": "class"
"class-name": "class"
},
children: [ { text: 'Example' } ]
},
Expand Down Expand Up @@ -1355,7 +1355,7 @@ const entryJsonRteWithClass = {
"children": [
{
"type": "p",
"attrs": {class: "class_p"},
"attrs": {"class-name": "class_p"},
"uid": "",
"children": [
{
Expand Down Expand Up @@ -1404,7 +1404,7 @@ const entryJsonRteWithId = {
"children": [
{
"type": "p",
"attrs": {class: "class_p"},
"attrs": {"class-name": "class_p"},
"uid": "",
"children": [
{
Expand Down Expand Up @@ -1459,7 +1459,7 @@ const jsonRteClassAndIdAttrs = {
"children": [
{
"type": "a",
"attrs": {"href": "LINK.com", class: "class_a", id: "id_p"},
"attrs": {"href": "LINK.com", "class-name": "class_a", id: "id_p"},
"uid": "",
"children": [
{
Expand All @@ -1470,7 +1470,7 @@ const jsonRteClassAndIdAttrs = {
{
"type": "img",
"attrs": {
class: "class_img",
"class-name": "class_img",
id: "id_img",
"src": "https://dummyImage.url/Donald.jog.png",
"width": 33.69418132611637,
Expand All @@ -1487,7 +1487,7 @@ const jsonRteClassAndIdAttrs = {
},
{
"type": "h1",
"attrs": {class: "class_h1", id: "id_h1"},
"attrs": {"class-name": "class_h1", id: "id_h1"},
"uid": "",
"children": [
{
Expand All @@ -1497,7 +1497,7 @@ const jsonRteClassAndIdAttrs = {
},
{
"type": "h2",
"attrs": {class: "class_h2", id: "id_h2"},
"attrs": {"class-name": "class_h2", id: "id_h2"},
"uid": "",
"children": [
{
Expand All @@ -1507,7 +1507,7 @@ const jsonRteClassAndIdAttrs = {
},
{
"type": "h3",
"attrs": {class: "class_h3", id: "id_h3"},
"attrs": {"class-name": "class_h3", id: "id_h3"},
"uid": "",
"children": [
{
Expand All @@ -1517,7 +1517,7 @@ const jsonRteClassAndIdAttrs = {
},
{
"type": "h4",
"attrs": {class: "class_h4", id: "id_h4"},
"attrs": {"class-name": "class_h4", id: "id_h4"},
"uid": "",
"children": [
{
Expand All @@ -1527,7 +1527,7 @@ const jsonRteClassAndIdAttrs = {
},
{
"type": "h5",
"attrs": {class: "class_h5", id: "id_h5"},
"attrs": {"class-name": "class_h5", id: "id_h5"},
"uid": "",
"children": [
{
Expand All @@ -1537,7 +1537,7 @@ const jsonRteClassAndIdAttrs = {
},
{
"type": "h6",
"attrs": {class: "class_h6", id: "id_h6"},
"attrs": {"class-name": "class_h6", id: "id_h6"},
"uid": "",
"children": [
{
Expand Down
6 changes: 3 additions & 3 deletions __test__/reference-to-html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Reference Node To HTML', () => {
const resultHTML = referenceToHTML(node, renderOption, (metadata: Metadata) => {
return findEmbeddedItems(metadata, embeddedEntryJsonEntry)[0]
})
expect(resultHTML).toEqual('<a href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>')
expect(resultHTML).toEqual('<a class=\"embedded-entry\" href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>')
done()
})

Expand Down Expand Up @@ -157,7 +157,7 @@ describe('Reference Node To HTML', () => {
const node = assetReferenceJson.children[0] as unknown as Node

const resultHTML = referenceToHTML(node, defaultNodeOption)
expect(resultHTML).toEqual('<img id=\"img_id\" src="https://image.url/11.jpg" />')
expect(resultHTML).toEqual('<img class=\"embedded-asset\" id=\"img_id\" src=\"https://image.url/11.jpg\" />')
done()
})

Expand All @@ -172,7 +172,7 @@ describe('Reference Node To HTML', () => {
const resultHTML = referenceToHTML(node, renderOption, (metadata: Metadata) => {
return findEmbeddedItems(metadata, { uid: 'uid' })[0]
})
expect(resultHTML).toEqual('<a href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>')
expect(resultHTML).toEqual('<a class=\"embedded-entry\" href=\"/copy-of-entry-final-02\" target=\"_self\">/copy-of-entry-final-02</a>')
done()
})
})
Loading