@@ -96,6 +96,21 @@ describe('DOM', () => {
96
96
'and some text afterwards.' , 'link with spaces in brackets' ) ;
97
97
} ) ;
98
98
99
+ it ( 'correctly converts code snippets' , ( ) => {
100
+ let result = dom . convertMarkdownLinkSnippets (
101
+ 'Some `code`. [Learn more](http://example.com).' ) ;
102
+ assert . equal ( result . innerHTML ,
103
+ '<span>Some <code>code</code>. </span>' +
104
+ '<a rel="noopener" target="_blank" href="http://example.com/">Learn more</a>.' ) ;
105
+
106
+ result = dom . convertMarkdownLinkSnippets (
107
+ '[link with `code`](https://example.com/foo) and some text afterwards.' ) ;
108
+ assert . equal ( result . innerHTML ,
109
+ '<a rel="noopener" target="_blank" href="https://example.com/foo">' +
110
+ '<span>link with <code>code</code></span>' +
111
+ '</a> and some text afterwards.' , 'link with code snippet inside' ) ;
112
+ } ) ;
113
+
99
114
it ( 'handles invalid urls' , ( ) => {
100
115
const text = 'Text has [bad](https:///) link.' ;
101
116
assert . throws ( ( ) => {
@@ -120,8 +135,9 @@ describe('DOM', () => {
120
135
const text = 'Ensuring `<td>` cells using the `[headers]` are good. ' +
121
136
'[Learn more](https://dequeuniversity.com/rules/axe/3.1/td-headers-attr).' ;
122
137
const result = dom . convertMarkdownLinkSnippets ( text ) ;
123
- assert . equal ( result . innerHTML , 'Ensuring `<td>` cells using the `[headers]` are ' +
124
- 'good. <a rel="noopener" target="_blank" href="https://dequeuniversity.com/rules/axe/3.1/td-headers-attr">Learn more</a>.' ) ;
138
+ assert . equal ( result . innerHTML ,
139
+ '<span>Ensuring <code><td></code> cells using the <code>[headers]</code> are ' +
140
+ 'good. </span><a rel="noopener" target="_blank" href="https://dequeuniversity.com/rules/axe/3.1/td-headers-attr">Learn more</a>.' ) ;
125
141
} ) ;
126
142
127
143
it ( 'appends utm params to the URLs with https://developers.google.com origin' , ( ) => {
0 commit comments