@@ -360,6 +360,30 @@ describe('paste-markdown', function () {
360360 paste ( textarea , data )
361361 assert . include ( textarea . value , tableMarkdown )
362362 } )
363+
364+ it ( 'pastes markdown with links correctly when identical labels are present' , function ( ) {
365+ // eslint-disable-next-line github/unescaped-html-literal
366+ const sentence = `<meta charset='utf-8'><span>
367+ foo bar baz <a href="https://www.abcxyz.com/">bar</a></span>`
368+ const plaintextSentence = 'foo bar baz bar'
369+ const markdownSentence = 'foo bar baz [bar](https://www.abcxyz.com/)'
370+
371+ paste ( textarea , { 'text/html' : sentence , 'text/plain' : plaintextSentence } )
372+ assert . equal ( textarea . value , markdownSentence )
373+ } )
374+
375+ it ( 'pastes markdown with line breaks and links correctly when identical labels are present' , function ( ) {
376+ // eslint-disable-next-line github/unescaped-html-literal
377+ const sentence = `<meta charset='utf-8'>
378+ <p>foo bar
379+ bar baz <a href="https://www.abcxyz.org/">bar</a> </p>
380+ <p>baz <a href="https://www.abcxyz.com/">baz</a> foo</p>`
381+ const plaintextSentence = 'foo bar bar baz bar baz baz foo'
382+ const markdownSentence = 'foo bar bar baz [bar](https://www.abcxyz.org/) baz [baz](https://www.abcxyz.com/) foo'
383+
384+ paste ( textarea , { 'text/html' : sentence , 'text/plain' : plaintextSentence } )
385+ assert . equal ( textarea . value , markdownSentence )
386+ } )
363387 } )
364388} )
365389
0 commit comments