@@ -156,4 +156,32 @@ describe('ep_embedded_hyperlinks2', function () {
156156 secondSpan . classList . contains ( 'b' ) ;
157157 } ) ;
158158 } ) ;
159+
160+ it ( 'has correct links after copy and paste' , async function ( ) {
161+ // FIXME use clipboard API
162+ const html = '<span class="url-beta.etherpad.com/"><a href="http://beta.etherpad.com/">1link, </a></span>\
163+ <span class="b url-beta.etherpad.com/"><a href="http://beta.etherpad.com/"><b>2bold</b></a></span>\
164+ <span class="url-beta.etherpad.com/"><a href="http://beta.etherpad.com/">, 3link</a></span>'
165+ helper . linesDiv ( ) [ 0 ] . html ( html ) ;
166+ await helper . waitForPromise ( ( ) => helper . commits . length === 1 ) ;
167+
168+ await helper . waitForPromise ( ( ) => {
169+ const lineText = helper . textLines ( ) [ 0 ] ;
170+ const firstSpan = helper . linesDiv ( ) [ 0 ] [ 0 ] . children [ 0 ] ;
171+ const secondSpan = helper . linesDiv ( ) [ 0 ] [ 0 ] . children [ 1 ] ;
172+ const thirdSpan = helper . linesDiv ( ) [ 0 ] [ 0 ] . children [ 2 ] ;
173+
174+ return lineText === '1link, 2bold, 3link' &&
175+ firstSpan . children [ 0 ] . getAttribute ( 'href' ) === 'http://beta.etherpad.com/' &&
176+ secondSpan . children [ 0 ] . getAttribute ( 'href' ) === 'http://beta.etherpad.com/' &&
177+ thirdSpan . children [ 0 ] . getAttribute ( 'href' ) === 'http://beta.etherpad.com/' &&
178+ firstSpan . classList . contains ( 'url-beta.etherpad.com/' ) &&
179+ ! firstSpan . classList . contains ( 'url-' ) &&
180+ secondSpan . classList . contains ( 'url-beta.etherpad.com/' ) &&
181+ ! secondSpan . classList . contains ( 'url-' ) &&
182+ thirdSpan . classList . contains ( 'url-beta.etherpad.com/' ) &&
183+ ! thirdSpan . classList . contains ( 'url-' ) &&
184+ secondSpan . classList . contains ( 'b' ) ;
185+ } ) ;
186+ } ) ;
159187} ) ;
0 commit comments