Skip to content

Commit 18b319c

Browse files
anchor link issue
1 parent ecd8a76 commit 18b319c

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

src/test/java/com/contentstack/utils/RTEResult.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ public class RTEResult {
1818
public static String kCodeHtml = "<code>Code template.</code>";
1919
public static String kLinkInPHtml = "<p><strong><em><u><sub></sub></u></em></strong><a href=\"LINK.com\">LINK</a></p>";
2020
public static String kEmbedHtml = "<iframe src=\"https://www.youtube.com/watch?v=AOP0yARiW8U\"></iframe>";
21+
public static String kAnchorHtml = "<p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">This is a paragraph with break true and<br />backslash nThis para has just one line break without any break key<br />Third paragraph with multiple line breaks<br /><br /><br />Fourth paragraph with multiple line breaks and break key<br /><br />Fifth paragraph with multiple only tab \t and this is text after tab<br />\tThis paragraph should start with a tab and should have a break before.</p>";
22+
public static String kWFSFeesHtml = "<p redactor-attributes=\"{}\" style=\"\" dir=\"ltr\">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <br /><br /><br />\t\t\t\tUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <br />Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <br />\tExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>";
23+
2124
}

src/test/java/com/contentstack/utils/TestRte.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ public void testHERFID() throws IOException {
102102
final String rte = "src/test/resources/reports/wfs_fees.json";
103103
JSONObject theRTE = new ReadResource().readJson(rte);
104104
String result = Utils.jsonToHTML(theRTE, new DefaultOption(), null);
105-
System.out.println(result);
105+
Assert.assertEquals(kWFSFeesHtml, result);
106106
}
107+
108+
109+
@Test
110+
public void testAnchorIssue() throws IOException {
111+
final String rte = "src/test/resources/reports/anchor.json";
112+
JSONObject theRTE = new ReadResource().readJson(rte);
113+
String result = Utils.jsonToHTML(theRTE, new DefaultOption(), null);
114+
Assert.assertEquals(kAnchorHtml, result);
115+
}
116+
117+
107118
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"uid": "a59f9108e99747d4b3358d9e22b7c685",
3+
"type": "doc",
4+
"attrs": {
5+
"dirty": true
6+
},
7+
"children": [
8+
{
9+
"type": "p",
10+
"uid": "a3c0687b2f694bd68ec290fd92a62330",
11+
"attrs": {
12+
"style": {},
13+
"redactor-attributes": {},
14+
"dir": "ltr"
15+
},
16+
"children": [
17+
{
18+
"text": "This is a paragraph with break true and"
19+
},
20+
{
21+
"text": "\n",
22+
"break": true
23+
},
24+
{
25+
"text": "backslash n"
26+
},
27+
{
28+
"text": "This para has just one line break without any break key"
29+
},
30+
{
31+
"text": "\n"
32+
},
33+
{
34+
"text": "Third paragraph with multiple line breaks"
35+
},
36+
{
37+
"text": "\n\n\n"
38+
},
39+
{
40+
"text": "Fourth paragraph with multiple line breaks and break key"
41+
},
42+
{
43+
"text": "\n\n",
44+
"break": true
45+
},
46+
{
47+
"text": "Fifth paragraph with multiple only tab \t and this is text after tab"
48+
},
49+
{
50+
"text": "\n\t"
51+
},
52+
{
53+
"text": "This paragraph should start with a tab and should have a break before."
54+
}
55+
]
56+
}
57+
]
58+
}

0 commit comments

Comments
 (0)