|
|
@@ -8,6 +8,7 @@
|
|
|
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
|
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
import Typing from '@ckeditor/ckeditor5-typing/src/typing';
|
|
|
+import LinkEditing from '@ckeditor/ckeditor5-link/src/linkediting';
|
|
|
import Widget from '../src/widget';
|
|
|
import DomEventData from '@ckeditor/ckeditor5-engine/src/view/observer/domeventdata';
|
|
|
|
|
|
@@ -32,7 +33,7 @@ describe( 'Widget - integration', () => {
|
|
|
editorElement = document.createElement( 'div' );
|
|
|
document.body.appendChild( editorElement );
|
|
|
|
|
|
- return ClassicEditor.create( editorElement, { plugins: [ Paragraph, Widget, Typing ] } )
|
|
|
+ return ClassicEditor.create( editorElement, { plugins: [ Paragraph, Widget, Typing, LinkEditing ] } )
|
|
|
.then( newEditor => {
|
|
|
editor = newEditor;
|
|
|
model = editor.model;
|
|
|
@@ -148,6 +149,31 @@ describe( 'Widget - integration', () => {
|
|
|
expect( getModelData( model ) ).to.equal( '<widget><nested>[foo bar]</nested></widget>' );
|
|
|
} );
|
|
|
|
|
|
+ it( 'should select the entire nested editable if triple clicked on link', () => {
|
|
|
+ setModelData( model, '[]<widget><nested>foo <$text linkHref="abc">bar</$text></nested></widget>' );
|
|
|
+
|
|
|
+ const viewDiv = viewDocument.getRoot().getChild( 0 );
|
|
|
+ const viewLink = viewDiv.getChild( 0 ).getChild( 1 );
|
|
|
+ const preventDefault = sinon.spy();
|
|
|
+ const domEventDataMock = new DomEventData( view, {
|
|
|
+ target: view.domConverter.mapViewToDom( viewLink ),
|
|
|
+ preventDefault,
|
|
|
+ detail: 3
|
|
|
+ } );
|
|
|
+
|
|
|
+ viewDocument.fire( 'mousedown', domEventDataMock );
|
|
|
+
|
|
|
+ sinon.assert.called( preventDefault );
|
|
|
+
|
|
|
+ expect( getViewData( view ) ).to.equal(
|
|
|
+ '<div class="ck-widget" contenteditable="false">' +
|
|
|
+ '<figcaption contenteditable="true">{foo <a href="abc">bar</a>]</figcaption>' +
|
|
|
+ '<div class="ck ck-reset_all ck-widget__type-around"></div>' +
|
|
|
+ '</div>'
|
|
|
+ );
|
|
|
+ expect( getModelData( model ) ).to.equal( '<widget><nested>[foo <$text linkHref="abc">bar</$text>]</nested></widget>' );
|
|
|
+ } );
|
|
|
+
|
|
|
it( 'should select proper nested editable if triple clicked', () => {
|
|
|
setModelData( model, '[]<widget><nested>foo</nested><nested>bar</nested></widget>' );
|
|
|
|