You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: __tests__/ExpensiMark-HTML-test.js
+49-49Lines changed: 49 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ const parser = new ExpensiMark();
5
5
6
6
// Words wrapped in * successfully replaced with <strong></strong>
7
7
test('Test bold markdown replacement',()=>{
8
-
constboldTestStartString='This is a *sentence,* and it has some *punctuation, words, and spaces*. '+'*test* * testing* test*test*test. * testing * *testing *';
8
+
constboldTestStartString='This is a **sentence,** and it has some **punctuation, words, and spaces**. '+'**test** * testing* test*test*test. * testing * *testing *';
9
9
constboldTestReplacedString=
10
10
'This is a <strong>sentence,</strong> and it has some <strong>punctuation, words, and spaces</strong>. '+'<strong>test</strong> * testing* test*test*test. * testing * *testing *';
// Sections starting with > are successfully wrapped with <blockquote></blockquote>
62
62
test('Test quote markdown replacement',()=>{
63
-
constquoteTestStartString='> This is a *quote* that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
63
+
constquoteTestStartString='> This is a **quote** that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
64
64
constquoteTestReplacedString=
65
65
'<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>Here is a >quote that did not<br /><pre>here is a codefenced quote<br />>it should not be quoted<br /></pre>';
test('Test quote markdown replacement with shouldEscapeText set as false',()=>{
71
-
constquoteTestStartString='> This is a *quote* that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
71
+
constquoteTestStartString='> This is a **quote** that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
72
72
constquoteTestReplacedString=
73
73
'<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>Here is a >quote that did not<br /><pre>here is a codefenced quote<br />>it should not be quoted<br /></pre>';
'[first no https://](www.expensify.com/_devportal/tools/logSearch/#query=request_id:(%22Ufjjim%22)+AND+timestamp:[2021-01-08T03:48:10.389Z+TO+2021-01-08T05:48:10.389Z]&index=logs_expensify-008878) '+
'<em>Here</em> is a _combination test_ that <marquee>sees</marquee> if ~https://www.example.com~ https://otherexample.com links get rendered first followed by *other markup* or if _*two work together*_ as well. This sentence also has a newline \n Yep just had one.';
601
+
'<em>Here</em> is a _combination test_ that <marquee>sees</marquee> if ~https://www.example.com~ https://otherexample.com links get rendered first followed by **other markup** or if _**two work together**_ as well. This sentence also has a newline \n Yep just had one.';
602
602
consturlTestReplacedString=
603
603
'<em>Here</em> is a <em>combination test</em> that <marquee>sees</marquee> if <del><a href="https://www.example.com" target="_blank" rel="noreferrer noopener">https://www.example.com</a></del> <a href="https://otherexample.com"'+
604
604
' target="_blank" rel="noreferrer noopener">https://otherexample.com</a> links get rendered first followed by <strong>other markup</strong> or if <em><strong>two work together</strong></em> as well. This sentence also has a newline <br /> Yep just had one.';
expect(parser.replace(testString)).toBe('<blockquote>*This is multiline</blockquote>bold text*');
1721
+
testString='> **This is multiline\nbold text**';
1722
+
expect(parser.replace(testString)).toBe('<blockquote>**This is multiline</blockquote>bold text**');
1723
1723
});
1724
1724
1725
1725
test('Test for email with test+1@gmail.com@gmail.com',()=>{
@@ -2003,7 +2003,7 @@ describe('when should keep raw input flag is enabled', () => {
2003
2003
});
2004
2004
2005
2005
test('quote with other markdowns',()=>{
2006
-
constquoteTestStartString='> This is a *quote* that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
2006
+
constquoteTestStartString='> This is a **quote** that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
2007
2007
constquoteTestReplacedString=
2008
2008
'<blockquote> This is a <strong>quote</strong> that started on a new line.</blockquote>\nHere is a >quote that did not\n<pre>\nhere is a codefenced quote\n>it should not be quoted\n</pre>';
2009
2009
@@ -2045,7 +2045,7 @@ describe('when should keep raw input flag is enabled', () => {
0 commit comments