Browse Source

Merge pull request #75 from ckeditor/t/74

Fix: The mention panel should have precendence over all other panels. Closes #74.
Piotrek Koszuliński 6 years ago
parent
commit
7ec3930416

+ 3 - 1
packages/ckeditor5-mention/src/mentionui.js

@@ -374,7 +374,9 @@ export default class MentionUI extends Plugin {
 			this._balloon.add( {
 				view: this._mentionsView,
 				position: this._getBalloonPanelPositionData( markerMarker, this._mentionsView.position ),
-				withArrow: false
+				withArrow: false,
+				singleViewMode: true,
+				stack: 'mention'
 			} );
 		}
 

+ 8 - 0
packages/ckeditor5-mention/tests/mentionui.js

@@ -96,10 +96,15 @@ describe( 'MentionUI', () => {
 	} );
 
 	describe( 'contextual balloon', () => {
+		let balloonAddSpy;
+
 		beforeEach( () => {
 			return createClassicTestEditor( staticConfig )
 				.then( () => {
 					setData( model, '<paragraph>foo []</paragraph>' );
+					const contextualBalloon = editor.plugins.get( ContextualBalloon );
+
+					balloonAddSpy = sinon.spy( contextualBalloon, 'add' );
 
 					model.change( writer => {
 						writer.insertText( '@', doc.selection.getFirstPosition() );
@@ -109,6 +114,9 @@ describe( 'MentionUI', () => {
 		} );
 
 		it( 'should disable arrow', () => {
+			sinon.assert.calledOnce( balloonAddSpy );
+			sinon.assert.calledWithExactly( balloonAddSpy, sinon.match( data => data.singleViewMode ) );
+			sinon.assert.calledWithExactly( balloonAddSpy, sinon.match( data => data.stack == 'mention' ) );
 			expect( panelView.isVisible ).to.be.true;
 			expect( panelView.withArrow ).to.be.false;
 		} );