Parcourir la source

Tests: The UI should hide when the selection expands.

Aleksander Nowodzinski il y a 7 ans
Parent
commit
31432a1437
2 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 1 0
      packages/ckeditor5-link/src/link.js
  2. 2 2
      packages/ckeditor5-link/tests/link.js

+ 1 - 0
packages/ckeditor5-link/src/link.js

@@ -379,6 +379,7 @@ export default class Link extends Plugin {
 			//   of the link,
 			// * the selection went to a different parent when creating a NEW link. E.g. someone
 			//   else modified the document.
+			// * the selection has expanded (e.g. displaying link actions then pressing SHIFT+Right arrow).
 			if ( ( prevSelectedLink && !selectedLink ) ||
 				( !prevSelectedLink && selectionParent !== prevSelectionParent ) ) {
 				this._hideUI();

+ 2 - 2
packages/ckeditor5-link/tests/link.js

@@ -324,8 +324,8 @@ describe( 'Link', () => {
 				const root = viewDocument.getRoot();
 				const text = root.getChild( 0 ).getChild( 0 ).getChild( 0 );
 
-				// Move selection to b[]az.
-				viewDocument.selection.setTo( Range.createFromParentsAndOffsets( text, 1, text, 1 ), true );
+				// Move selection to f[o]o.
+				viewDocument.selection.setTo( Range.createFromParentsAndOffsets( text, 1, text, 2 ), true );
 				viewDocument.render();
 
 				sinon.assert.calledOnce( spyHide );