|
@@ -7,7 +7,7 @@ import ViewDocumentFragment from '@ckeditor/ckeditor5-engine/src/view/documentfr
|
|
|
import ViewDowncastWriter from '@ckeditor/ckeditor5-engine/src/view/downcastwriter';
|
|
import ViewDowncastWriter from '@ckeditor/ckeditor5-engine/src/view/downcastwriter';
|
|
|
import ViewDocument from '@ckeditor/ckeditor5-engine/src/view/document';
|
|
import ViewDocument from '@ckeditor/ckeditor5-engine/src/view/document';
|
|
|
import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element';
|
|
import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element';
|
|
|
-import { toImageWidget, isImageWidget, isImageWidgetSelected, isImage, isImageAllowed, insertImage } from '../../src/image/utils';
|
|
|
|
|
|
|
+import { toImageWidget, isImageWidget, getSelectedImageWidget, isImage, isImageAllowed, insertImage } from '../../src/image/utils';
|
|
|
import { isWidget, getLabel } from '@ckeditor/ckeditor5-widget/src/utils';
|
|
import { isWidget, getLabel } from '@ckeditor/ckeditor5-widget/src/utils';
|
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
|
|
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
|
|
@@ -57,7 +57,7 @@ describe( 'image widget utils', () => {
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- describe( 'isImageWidgetSelected()', () => {
|
|
|
|
|
|
|
+ describe( 'getSelectedImageWidget()', () => {
|
|
|
let frag;
|
|
let frag;
|
|
|
|
|
|
|
|
it( 'should return true when image widget is the only element in the selection', () => {
|
|
it( 'should return true when image widget is the only element in the selection', () => {
|
|
@@ -66,7 +66,7 @@ describe( 'image widget utils', () => {
|
|
|
|
|
|
|
|
const selection = writer.createSelection( element, 'on' );
|
|
const selection = writer.createSelection( element, 'on' );
|
|
|
|
|
|
|
|
- expect( isImageWidgetSelected( selection ) ).to.be.true;
|
|
|
|
|
|
|
+ expect( getSelectedImageWidget( selection ) ).to.equal( element );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should return false when non-widgetized elements is the only element in the selection', () => {
|
|
it( 'should return false when non-widgetized elements is the only element in the selection', () => {
|
|
@@ -77,7 +77,7 @@ describe( 'image widget utils', () => {
|
|
|
|
|
|
|
|
const selection = writer.createSelection( notWidgetizedElement, 'on' );
|
|
const selection = writer.createSelection( notWidgetizedElement, 'on' );
|
|
|
|
|
|
|
|
- expect( isImageWidgetSelected( selection ) ).to.be.false;
|
|
|
|
|
|
|
+ expect( getSelectedImageWidget( selection ) ).to.be.null;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should return false when widget element is not the only element in the selection', () => {
|
|
it( 'should return false when widget element is not the only element in the selection', () => {
|
|
@@ -87,7 +87,7 @@ describe( 'image widget utils', () => {
|
|
|
|
|
|
|
|
const selection = writer.createSelection( writer.createRangeIn( frag ) );
|
|
const selection = writer.createSelection( writer.createRangeIn( frag ) );
|
|
|
|
|
|
|
|
- expect( isImageWidgetSelected( selection ) ).to.be.false;
|
|
|
|
|
|
|
+ expect( getSelectedImageWidget( selection ) ).to.be.null;
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|