Skip to content

Commit

Permalink
Changes in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumluregn committed Jul 28, 2022
1 parent 7845902 commit eccc841
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/ckeditor5-highlight/tests/highlightui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-image/src/imagestyle/imagestyleui.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export default class ImageStyleUI extends Plugin {

_executeCommand( name ) {
this.editor.execute( 'imageStyle', { value: name } );
this.editor.editing.view.focus();
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/ckeditor5-image/tests/imagestyle/imagestyleui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit eccc841

Please sign in to comment.