@@ -281,6 +281,7 @@ test('switching to a different mention starts it and ends the previous one', asy
281281 await expect ( eventType ( page ) ) . toHaveText ( 'start' ) ;
282282 await expect ( eventIndicator ( page ) ) . toHaveText ( '@' ) ;
283283 await expect ( lastEndEvent ( page ) ) . toHaveText ( '#' ) ;
284+ await editor . press ( 'ArrowLeft' ) ;
284285 await editor . press ( 'ArrowLeft' ) ; // back to the '#' mention
285286 await expect ( eventType ( page ) ) . toHaveText ( 'change' ) ;
286287 await expect ( eventIndicator ( page ) ) . toHaveText ( '#' ) ;
@@ -291,3 +292,24 @@ test('switching to a different mention starts it and ends the previous one', asy
291292 await expect ( eventType ( page ) ) . toHaveText ( 'end' ) ;
292293 await expect ( eventIndicator ( page ) ) . toHaveText ( '#' ) ;
293294} ) ;
295+
296+ test ( "inserting a mention between text doesn't produce a double space" , async ( {
297+ page,
298+ } ) => {
299+ await gotoMentionTest ( page ) ;
300+ const editor = mentionEditor ( page ) ;
301+ await editor . click ( ) ;
302+ await editor . pressSequentially ( 'example ' , { delay : 80 } ) ;
303+ await editor . pressSequentially ( ' test' , { delay : 80 } ) ;
304+ for ( let i = 0 ; i < 5 ; i ++ ) {
305+ await editor . press ( 'ArrowLeft' ) ;
306+ }
307+ await editor . press ( '@' ) ;
308+ await page . locator ( sel . setUserButton ) . click ( ) ;
309+ await page . waitForTimeout ( 2000 ) ;
310+ await expect
311+ . poll ( async ( ) => await htmlOutput ( page ) . textContent ( ) )
312+ . toEqual (
313+ '<html><p>example <mention text="Jane" indicator="@" id="1">Jane</mention> test</p></html>'
314+ ) ;
315+ } ) ;
0 commit comments