File tree Expand file tree Collapse file tree
tests/unit/components/NcRichText Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,6 +192,37 @@ describe('Foo', () => {
192192 expect ( wrapper . find ( 'em' ) . text ( ) ) . toEqual ( 'to' )
193193 } )
194194
195+ it ( 'does not autolink markdown link text that is already inside a link' , async ( ) => {
196+ const wrapper = mount ( NcRichText , {
197+ props : {
198+ text : '[https://example-nested.org](https://example.com)' ,
199+ autolink : true ,
200+ useMarkdown : true ,
201+ } ,
202+ } )
203+
204+ const links = wrapper . findAll ( 'a' )
205+ expect ( links ) . toHaveLength ( 1 )
206+ expect ( links [ 0 ] . attributes ( 'href' ) ) . toEqual ( 'https://example.com' )
207+ expect ( links [ 0 ] . text ( ) ) . toEqual ( 'https://example-nested.org' )
208+ } )
209+
210+ it ( 'does not autolink deeply nested markdown link text that is already inside a link' , async ( ) => {
211+ const wrapper = mount ( NcRichText , {
212+ props : {
213+ text : '[**https://example-nested.org**](https://example.com)' ,
214+ autolink : true ,
215+ useMarkdown : true ,
216+ } ,
217+ } )
218+
219+ const links = wrapper . findAll ( 'a' )
220+ expect ( links ) . toHaveLength ( 1 )
221+ expect ( links [ 0 ] . attributes ( 'href' ) ) . toEqual ( 'https://example.com' )
222+ expect ( links [ 0 ] . text ( ) ) . toEqual ( 'https://example-nested.org' )
223+ expect ( wrapper . find ( 'strong' ) . text ( ) ) . toEqual ( 'https://example-nested.org' )
224+ } )
225+
195226 it ( 'formats markdown is disabled' , async ( ) => {
196227 const wrapper = mount ( NcRichText , {
197228 props : {
You can’t perform that action at this time.
0 commit comments