@@ -43,6 +43,14 @@ describe('paste-markdown', function () {
43
43
assert . equal ( textarea . value , 'The examples can be found [here](https://github.com).' )
44
44
} )
45
45
46
+ it ( 'creates a markdown link when the pasted url includes a trailing slash' , function ( ) {
47
+ // eslint-disable-next-line i18n-text/no-en
48
+ textarea . value = 'The examples can be found here.'
49
+ textarea . setSelectionRange ( 26 , 30 )
50
+ paste ( textarea , { 'text/plain' : 'https://www.github.com/' } )
51
+ assert . equal ( textarea . value , 'The examples can be found [here](https://www.github.com/).' )
52
+ } )
53
+
46
54
it ( "doesn't paste a markdown URL when pasting over a selected URL" , function ( ) {
47
55
// eslint-disable-next-line i18n-text/no-en
48
56
textarea . value = 'The examples can be found here: https://docs.github.com'
@@ -66,6 +74,15 @@ describe('paste-markdown', function () {
66
74
assert . equal ( textarea . value , '@' )
67
75
} )
68
76
77
+ it ( "doesn't paste markdown URL when additional text is being copied" , function ( ) {
78
+ textarea . value = 'github'
79
+ textarea . setSelectionRange ( 0 , 6 )
80
+ paste ( textarea , { 'text/plain' : 'https://github.com plus some other content' } )
81
+ // Synthetic paste events don't manipulate the DOM. The same textarea value
82
+ // means that the event handler didn't fire and normal paste happened.
83
+ assert . equal ( textarea . value , 'github' )
84
+ } )
85
+
69
86
it ( 'turns html tables into markdown' , function ( ) {
70
87
const data = {
71
88
'text/html' : tableHtml
0 commit comments