Skip to content

Commit

Permalink
Remove unnecessary workaround from tests (after moving button focus e…
Browse files Browse the repository at this point in the history
…lsewhere).
  • Loading branch information
Dumluregn committed Jul 28, 2022
1 parent 3fd1f22 commit 7845902
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 19 deletions.
2 changes: 0 additions & 2 deletions packages/ckeditor5-highlight/tests/highlightui.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ describe( 'HighlightUI', () => {
it( 'should change button on execute option', () => {
command.value = 'yellowMarker';
validateButton( 0 );
button.render();

buttons[ 5 ].fire( 'execute' );
command.value = 'greenPen';
Expand All @@ -193,7 +192,6 @@ describe( 'HighlightUI', () => {
it( 'should focus view after command execution', () => {
const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );

button.render();
button.commandName = 'highlight';
button.fire( 'execute' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ describe( 'ImageResizeButtons', () => {
const commandSpy = sinon.spy( command, 'execute' );
const resizeBy50Percent = dropdownView.listView.items._items[ 1 ].children._items[ 0 ];

dropdownView.render();
command.isEnabled = true;

resizeBy50Percent.fire( 'execute' );
Expand Down
2 changes: 0 additions & 2 deletions packages/ckeditor5-image/tests/imagestyle/imagestyleui.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ describe( 'ImageStyleUI', () => {
const commandSpy = sinon.spy( editor, 'execute' );

for ( const { view, buttonView } of dropdowns ) {
buttonView.render();
buttonView.fire( 'execute' );

sinon.assert.notCalled( commandSpy );
Expand Down Expand Up @@ -469,7 +468,6 @@ describe( 'ImageStyleUI', () => {
const focusSpy = sinon.stub( editor.editing.view, 'focus' );

for ( const { buttonView, config, view } of dropdowns ) {
buttonView.render();
buttonView.fire( 'execute' );

expect( view.isOpen ).to.be.false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ describe( 'ListPropertiesUI', () => {
it( 'should close the drop-down when any button gets executed', () => {
const spy = sinon.spy();

bulletedListDropdown.render();
bulletedListDropdown.on( 'execute', spy );
listPropertiesView.fire( 'execute' );

Expand All @@ -284,7 +283,6 @@ describe( 'ListPropertiesUI', () => {
beforeEach( () => {
// "circle"
styleButtonView = stylesView.children.get( 1 );
bulletedListDropdown.render();

sinon.spy( editor, 'execute' );
sinon.spy( editor.editing.view, 'focus' );
Expand Down Expand Up @@ -563,7 +561,6 @@ describe( 'ListPropertiesUI', () => {
it( 'should close the drop-down when any button gets executed', () => {
const spy = sinon.spy();

numberedListDropdown.render();
numberedListDropdown.on( 'execute', spy );
listPropertiesView.fire( 'execute' );

Expand All @@ -585,7 +582,6 @@ describe( 'ListPropertiesUI', () => {
beforeEach( () => {
// "decimal-leading-zero""
styleButtonView = stylesView.children.get( 1 );
numberedListDropdown.render();

sinon.spy( editor, 'execute' );
sinon.spy( editor.editing.view, 'focus' );
Expand Down
3 changes: 0 additions & 3 deletions packages/ckeditor5-style/tests/styleui.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ describe( 'StyleUI', () => {

testUtils.sinon.stub( editor, 'execute' );

dropdown.render();
dropdown.isOpen = true;

dropdown.panelView.children.first.fire( new EventInfo( buttonMock, 'execute' ) );
Expand Down Expand Up @@ -153,7 +152,6 @@ describe( 'StyleUI', () => {
}
};

dropdown.render();
dropdown.on( 'execute', spy );

panel.fire( new EventInfo( buttonMock, 'execute' ) );
Expand All @@ -168,7 +166,6 @@ describe( 'StyleUI', () => {
}
};

dropdown.render();
panel.fire( new EventInfo( buttonMock, 'execute' ) );

sinon.assert.calledOnceWithExactly( commandExecuteStub, 'style', { styleName: 'foo' } );
Expand Down
8 changes: 1 addition & 7 deletions packages/ckeditor5-table/tests/tableui.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe( 'TableUI', () => {

tableSizeView.rows = 2;
tableSizeView.columns = 7;
insertTable.render();

insertTable.fire( 'execute' );

sinon.assert.calledOnce( executeSpy );
Expand Down Expand Up @@ -193,7 +193,6 @@ describe( 'TableUI', () => {
it( 'should focus view after command execution', () => {
const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );

dropdown.render();
dropdown.listView.items.get( 2 ).children.last.fire( 'execute' );

sinon.assert.calledOnce( focusSpy );
Expand All @@ -202,7 +201,6 @@ describe( 'TableUI', () => {
it( 'should not focus view after using a switchbutton', () => {
const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );

dropdown.render();
dropdown.listView.items.first.children.last.fire( 'execute' );

sinon.assert.notCalled( focusSpy );
Expand Down Expand Up @@ -340,7 +338,6 @@ describe( 'TableUI', () => {
it( 'should focus view after command execution', () => {
const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );

dropdown.render();
dropdown.listView.items.get( 2 ).children.first.fire( 'execute' );

sinon.assert.calledOnce( focusSpy );
Expand All @@ -349,7 +346,6 @@ describe( 'TableUI', () => {
it( 'should not focus view after using a switchbutton', () => {
const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );

dropdown.render();
dropdown.listView.items.first.children.last.fire( 'execute' );

sinon.assert.notCalled( focusSpy );
Expand Down Expand Up @@ -539,7 +535,6 @@ describe( 'TableUI', () => {
it( 'should focus view after command execution', () => {
const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );

dropdown.render();
dropdown.listView.items.first.children.first.fire( 'execute' );

sinon.assert.calledOnce( focusSpy );
Expand All @@ -548,7 +543,6 @@ describe( 'TableUI', () => {
it( 'executes command when it\'s executed', () => {
const spy = sinon.stub( editor, 'execute' );

dropdown.render();
dropdown.listView.items.first.children.first.fire( 'execute' );

expect( spy.calledOnce ).to.be.true;
Expand Down

0 comments on commit 7845902

Please sign in to comment.