Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Simplified the tests after removing throttle from the EditorUI#update…
Browse files Browse the repository at this point in the history
… event.
  • Loading branch information
oskarwrobel committed Jun 28, 2018
1 parent ba4dab8 commit 299e5f4
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions tests/toolbar/block/blocktoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,27 +211,18 @@ describe( 'BlockToolbar', () => {

setData( editor.model, '<foo>foo[]bar</foo>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

expect( blockToolbar.buttonView.isVisible ).to.be.true;
} );

it( 'should display the button when the first selected block is an object', () => {
setData( editor.model, '[<image src="foo.jpg"><caption>foo</caption></image>]' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

expect( blockToolbar.buttonView.isVisible ).to.be.true;
} );

it( 'should display the button when the selection is inside the object', () => {
setData( editor.model, '<image src="foo.jpg"><caption>f[]oo</caption></image>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

expect( blockToolbar.buttonView.isVisible ).to.be.true;
} );

Expand All @@ -240,9 +231,6 @@ describe( 'BlockToolbar', () => {

setData( editor.model, '<paragraph>foo</paragraph>[]<paragraph>bar</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

expect( blockToolbar.buttonView.isVisible ).to.be.false;
} );

Expand All @@ -259,9 +247,6 @@ describe( 'BlockToolbar', () => {

setData( editor.model, '[<image src="foo.jpg"></image>]' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

expect( blockToolbar.buttonView.isVisible ).to.be.false;

element.remove();
Expand All @@ -282,9 +267,6 @@ describe( 'BlockToolbar', () => {
'of the selected block #1', () => {
setData( editor.model, '<paragraph>foo[]bar</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

const target = editor.ui.view.editableElement.querySelector( 'p' );
const styleMock = testUtils.sinon.stub( window, 'getComputedStyle' );

Expand Down Expand Up @@ -319,9 +301,6 @@ describe( 'BlockToolbar', () => {
'of the selected block #2', () => {
setData( editor.model, '<paragraph>foo[]bar</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

const target = editor.ui.view.editableElement.querySelector( 'p' );
const styleMock = testUtils.sinon.stub( window, 'getComputedStyle' );

Expand Down Expand Up @@ -401,9 +380,6 @@ describe( 'BlockToolbar', () => {
it( 'should hide the UI when editor switches to readonly when the panel is not visible', () => {
setData( editor.model, '<paragraph>foo[]bar</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

blockToolbar.buttonView.isVisible = true;
blockToolbar.panelView.isVisible = false;

Expand All @@ -416,9 +392,6 @@ describe( 'BlockToolbar', () => {
it( 'should not hide button when the editor switches to readonly when the panel is visible', () => {
setData( editor.model, '<paragraph>foo[]bar</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

blockToolbar.buttonView.isVisible = true;
blockToolbar.panelView.isVisible = true;

Expand All @@ -436,18 +409,12 @@ describe( 'BlockToolbar', () => {
// Place the selection outside of any block because the toolbar will not be shown in this case.
setData( editor.model, '[]<paragraph>bar</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

window.dispatchEvent( new Event( 'resize' ) );

sinon.assert.notCalled( spy );

setData( editor.model, '<paragraph>ba[]r</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

spy.resetHistory();

window.dispatchEvent( new Event( 'resize' ) );
Expand All @@ -456,9 +423,6 @@ describe( 'BlockToolbar', () => {

setData( editor.model, '[]<paragraph>bar</paragraph>' );

// "Flush" throttled event.
editor.ui.fire( 'update' );

spy.resetHistory();

window.dispatchEvent( new Event( 'resize' ) );
Expand Down

0 comments on commit 299e5f4

Please sign in to comment.