From 376beaa31966308a0494330c33cd54452f3e7594 Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Thu, 10 Oct 2019 14:31:34 +0200 Subject: [PATCH] Tests: Since WidgetResize._resizers is now private use _getResizerByViewElement method instead. --- tests/imageresize.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/imageresize.js b/tests/imageresize.js index e8d12f6e..18a812df 100644 --- a/tests/imageresize.js +++ b/tests/imageresize.js @@ -131,7 +131,7 @@ describe( 'ImageResize', () => { it( 'disables the resizer if the command is disabled', () => { setData( editor.model, `foo[]` ); - const resizer = getFirstResizer( editor ); + const resizer = getSelectedImageResizer( editor ); let isEnabled = false; @@ -161,7 +161,7 @@ describe( 'ImageResize', () => { editor.model.insertContent( writer.createElement( 'image', { src: IMAGE_SRC_FIXTURE } ) ); } ); - const resizer = getFirstResizer( editor ); + const resizer = getSelectedImageResizer( editor ); const resizerWrapper = editor.ui.getEditableElement().querySelector( '.ck-widget__resizer' ); expect( resizer.isEnabled ).to.be.false; @@ -659,7 +659,7 @@ describe( 'ImageResize', () => { it( 'hides the resize wrapper when its disabled', () => { setData( editor.model, `foo[]` ); - const resizer = getFirstResizer( editor ); + const resizer = getSelectedImageResizer( editor ); const resizerWrapper = editor.ui.getEditableElement().querySelector( '.ck-widget__resizer' ); expect( resizerWrapper.style.display ).to.equal( '' ); @@ -762,8 +762,10 @@ describe( 'ImageResize', () => { editor.ui.focusTracker.isFocused = true; } - function getFirstResizer( editor ) { - return Array.from( editor.plugins.get( 'WidgetResize' ).resizers.values() )[ 0 ]; + function getSelectedImageResizer( editor ) { + return editor.plugins.get( 'WidgetResize' )._getResizerByViewElement( + editor.editing.view.document.selection.getSelectedElement() + ); } function createEditor( config ) {