diff --git a/packages/ckeditor5-highlight/tests/highlightui.js b/packages/ckeditor5-highlight/tests/highlightui.js index ff048f69126..c60b230442a 100644 --- a/packages/ckeditor5-highlight/tests/highlightui.js +++ b/packages/ckeditor5-highlight/tests/highlightui.js @@ -192,8 +192,8 @@ describe( 'HighlightUI', () => { it( 'should focus view after command execution', () => { const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' ); - button.commandName = 'highlight'; - button.fire( 'execute' ); + dropdown.buttonView.commandName = 'highlight'; + dropdown.buttonView.fire( 'execute' ); sinon.assert.calledOnce( focusSpy ); } ); diff --git a/packages/ckeditor5-image/src/imagestyle/imagestyleui.js b/packages/ckeditor5-image/src/imagestyle/imagestyleui.js index 57b3ba23944..c6c03093f6f 100644 --- a/packages/ckeditor5-image/src/imagestyle/imagestyleui.js +++ b/packages/ckeditor5-image/src/imagestyle/imagestyleui.js @@ -212,6 +212,7 @@ export default class ImageStyleUI extends Plugin { _executeCommand( name ) { this.editor.execute( 'imageStyle', { value: name } ); + this.editor.editing.view.focus(); } } diff --git a/packages/ckeditor5-image/tests/imagestyle/imagestyleui.js b/packages/ckeditor5-image/tests/imagestyle/imagestyleui.js index 01ed1c54e3a..054b6cbe74f 100644 --- a/packages/ckeditor5-image/tests/imagestyle/imagestyleui.js +++ b/packages/ckeditor5-image/tests/imagestyle/imagestyleui.js @@ -146,12 +146,14 @@ describe( 'ImageStyleUI', () => { it( 'should execute the command when the button is being clicked', () => { const commandSpy = sinon.spy( editor, 'execute' ); + const focusSpy = sinon.stub( editor.editing.view, 'focus' ); for ( const { config, buttonView } of buttons ) { buttonView.fire( 'execute' ); sinon.assert.calledOnce( commandSpy ); sinon.assert.calledWithExactly( commandSpy, 'imageStyle', { value: config.name } ); + sinon.assert.called( focusSpy ); commandSpy.resetHistory(); }