|
|
@@ -59,6 +59,9 @@ describe( 'Widget - integration', () => {
|
|
|
isObject: true,
|
|
|
isInline: true
|
|
|
} );
|
|
|
+ model.schema.extend( '$block', {
|
|
|
+ allowIn: 'nested'
|
|
|
+ } );
|
|
|
|
|
|
editor.conversion.for( 'downcast' )
|
|
|
.elementToElement( { model: 'inline', view: 'figure' } )
|
|
|
@@ -174,6 +177,51 @@ describe( 'Widget - integration', () => {
|
|
|
expect( getModelData( model ) ).to.equal( '<widget><nested>[foo <$text linkHref="abc">bar</$text>]</nested></widget>' );
|
|
|
} );
|
|
|
|
|
|
+ it( 'should select only clicked paragraph if triple clicked on link', () => {
|
|
|
+ setModelData( model,
|
|
|
+ '[]<widget>' +
|
|
|
+ '<nested>' +
|
|
|
+ '<paragraph>foo</paragraph>' +
|
|
|
+ '<paragraph>foo <$text linkHref="abc">bar</$text></paragraph>' +
|
|
|
+ '<paragraph>bar</paragraph>' +
|
|
|
+ '</nested>' +
|
|
|
+ '</widget>'
|
|
|
+ );
|
|
|
+
|
|
|
+ const viewDiv = viewDocument.getRoot().getChild( 0 );
|
|
|
+ const viewLink = viewDiv.getChild( 0 ).getChild( 1 ).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">' +
|
|
|
+ '<p>foo</p>' +
|
|
|
+ '<p>{foo <a href="abc">bar</a>]</p>' +
|
|
|
+ '<p>bar</p>' +
|
|
|
+ '</figcaption>' +
|
|
|
+ '<div class="ck ck-reset_all ck-widget__type-around"></div>' +
|
|
|
+ '</div>'
|
|
|
+ );
|
|
|
+ expect( getModelData( model ) ).to.equal(
|
|
|
+ '<widget>' +
|
|
|
+ '<nested>' +
|
|
|
+ '<paragraph>foo</paragraph>' +
|
|
|
+ '<paragraph>[foo <$text linkHref="abc">bar</$text>]</paragraph>' +
|
|
|
+ '<paragraph>bar</paragraph>' +
|
|
|
+ '</nested>' +
|
|
|
+ '</widget>'
|
|
|
+ );
|
|
|
+ } );
|
|
|
+
|
|
|
it( 'should select proper nested editable if triple clicked', () => {
|
|
|
setModelData( model, '[]<widget><nested>foo</nested><nested>bar</nested></widget>' );
|
|
|
|