@@ -46,7 +46,7 @@ describe("Markdown parser test", () => {
46
46
"https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org" ,
47
47
] . join ( "\n" ) ;
48
48
49
- it ( 'tests that links are getting properly HTML formatted' , ( ) => {
49
+ it ( 'tests that links with markdown empasis in them are getting properly HTML formatted' , ( ) => {
50
50
/* eslint-disable max-len */
51
51
const expectedResult = [
52
52
"<p>Test1:<br />#_foonetic_xkcd:matrix.org<br />http://google.com/_thing_<br />https://matrix.org/_matrix/client/foo/123_<br />#_foonetic_xkcd:matrix.org</p>" ,
@@ -125,7 +125,7 @@ describe("Markdown parser test", () => {
125
125
expect ( md . toHTML ( ) ) . toEqual ( expectedResult ) ;
126
126
} ) ;
127
127
128
- it ( 'expects that links in one line will be "escaped" properly ' , ( ) => {
128
+ it ( 'expects that links with emphasis are "escaped" correctly ' , ( ) => {
129
129
/* eslint-disable max-len */
130
130
const testString = [
131
131
'http://domain.xyz/foo/bar-_stuff-like-this_-in-it.jpg' + " " + 'http://domain.xyz/foo/bar-_stuff-like-this_-in-it.jpg' ,
@@ -139,5 +139,29 @@ describe("Markdown parser test", () => {
139
139
const md = new Markdown ( testString ) ;
140
140
expect ( md . toHTML ( ) ) . toEqual ( expectedResult ) ;
141
141
} ) ;
142
+
143
+ it ( 'expects that the link part will not be accidentally added to <strong>' , ( ) => {
144
+ /* eslint-disable max-len */
145
+ const testString = `https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py` ;
146
+ const expectedResult = 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' ;
147
+ /* eslint-enable max-len */
148
+ const md = new Markdown ( testString ) ;
149
+ expect ( md . toHTML ( ) ) . toEqual ( expectedResult ) ;
150
+ } ) ;
151
+
152
+ it ( 'expects that the link part will not be accidentally added to <strong> for multiline links' , ( ) => {
153
+ /* eslint-disable max-len */
154
+ const testString = [
155
+ 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' + " " + 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' ,
156
+ 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' + " " + 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' ,
157
+ ] . join ( '\n' ) ;
158
+ const expectedResult = [
159
+ 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' + " " + 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' ,
160
+ 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' + " " + 'https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py' ,
161
+ ] . join ( '<br />' ) ;
162
+ /* eslint-enable max-len */
163
+ const md = new Markdown ( testString ) ;
164
+ expect ( md . toHTML ( ) ) . toEqual ( expectedResult ) ;
165
+ } ) ;
142
166
} ) ;
143
167
} ) ;
0 commit comments