From 14501dc41a5cf9b5ca30e3e1a9cdad4fe77ffdf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Mon, 27 May 2019 16:24:15 +0200 Subject: [PATCH] Mention contextual balloon panel should be opened with singleViewMode=true. --- src/mentionui.js | 4 +++- tests/mentionui.js | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mentionui.js b/src/mentionui.js index 2bc4d91..475adc8 100644 --- a/src/mentionui.js +++ b/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' } ); } diff --git a/tests/mentionui.js b/tests/mentionui.js index bc95448..946c089 100644 --- a/tests/mentionui.js +++ b/tests/mentionui.js @@ -96,10 +96,15 @@ describe( 'MentionUI', () => { } ); describe( 'contextual balloon', () => { + let balloonAddSpy; + beforeEach( () => { return createClassicTestEditor( staticConfig ) .then( () => { setData( model, 'foo []' ); + 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; } );