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

Commit

Permalink
Tests: Since WidgetResize._resizers is now private use _getResizerByV…
Browse files Browse the repository at this point in the history
…iewElement method instead.
  • Loading branch information
mlewand committed Oct 10, 2019
1 parent 82871a7 commit 376beaa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/imageresize.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe( 'ImageResize', () => {
it( 'disables the resizer if the command is disabled', () => {
setData( editor.model, `<paragraph>foo</paragraph>[<image src="${ IMAGE_SRC_FIXTURE }"></image>]` );

const resizer = getFirstResizer( editor );
const resizer = getSelectedImageResizer( editor );

let isEnabled = false;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -659,7 +659,7 @@ describe( 'ImageResize', () => {
it( 'hides the resize wrapper when its disabled', () => {
setData( editor.model, `<paragraph>foo</paragraph>[<image src="${ IMAGE_SRC_FIXTURE }"></image>]` );

const resizer = getFirstResizer( editor );
const resizer = getSelectedImageResizer( editor );
const resizerWrapper = editor.ui.getEditableElement().querySelector( '.ck-widget__resizer' );

expect( resizerWrapper.style.display ).to.equal( '' );
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit 376beaa

Please sign in to comment.