|
|
@@ -2759,7 +2759,7 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', `[<horizontalLine></horizontalLine>]<paragraph>word ${ text }</paragraph>`, '12' ],
|
|
|
+ [ '10', `<horizontalLine></horizontalLine><paragraph>[]word ${ text }</paragraph>`, '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
} );
|
|
|
@@ -2778,7 +2778,7 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', `<paragraph>${ text } word word</paragraph>[<horizontalLine></horizontalLine>]`, '12' ],
|
|
|
+ [ '10', `<paragraph>${ text } word word[]</paragraph><horizontalLine></horizontalLine>`, '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
} );
|
|
|
@@ -2844,7 +2844,7 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', '[<horizontalLine></horizontalLine><paragraph>foo]bar</paragraph>', '12' ],
|
|
|
+ [ '10', '<horizontalLine></horizontalLine><paragraph>[foo]bar</paragraph>', '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
} );
|
|
|
@@ -2863,7 +2863,7 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', '<paragraph>foo[bar</paragraph><horizontalLine></horizontalLine>]', '12' ],
|
|
|
+ [ '10', '<paragraph>foo[bar]</paragraph><horizontalLine></horizontalLine>', '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
} );
|
|
|
@@ -2897,7 +2897,7 @@ describe( 'TableKeyboard', () => {
|
|
|
sinon.assert.notCalled( rightArrowDomEvtDataStub.stopPropagation );
|
|
|
} );
|
|
|
|
|
|
- it( 'should not navigate to the cell above', () => {
|
|
|
+ it( 'should not navigate to the cell above (only to closest limit boundary)', () => {
|
|
|
setModelData( model, modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
[ '10', `<paragraph>foo</paragraph><image src="${ imageUrl }"><caption>1[]1</caption></image>`, '12' ],
|
|
|
@@ -2906,11 +2906,30 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
editor.editing.view.document.fire( 'keydown', upArrowDomEvtDataStub );
|
|
|
|
|
|
+ sinon.assert.calledOnce( upArrowDomEvtDataStub.preventDefault );
|
|
|
+ sinon.assert.calledOnce( upArrowDomEvtDataStub.stopPropagation );
|
|
|
+
|
|
|
+ assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
+ [ '00', '01', '02' ],
|
|
|
+ [ '10', `<paragraph>foo</paragraph><image src="${ imageUrl }"><caption>[]11</caption></image>`, '12' ],
|
|
|
+ [ '20', '21', '22' ]
|
|
|
+ ] ) );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should not navigate to the cell above (only to paragraph above)', () => {
|
|
|
+ setModelData( model, modelTable( [
|
|
|
+ [ '00', '01', '02' ],
|
|
|
+ [ '10', `<paragraph>foo</paragraph><image src="${ imageUrl }"><caption>[]11</caption></image>`, '12' ],
|
|
|
+ [ '20', '21', '22' ]
|
|
|
+ ] ) );
|
|
|
+
|
|
|
+ editor.editing.view.document.fire( 'keydown', upArrowDomEvtDataStub );
|
|
|
+
|
|
|
sinon.assert.notCalled( upArrowDomEvtDataStub.preventDefault );
|
|
|
sinon.assert.notCalled( upArrowDomEvtDataStub.stopPropagation );
|
|
|
} );
|
|
|
|
|
|
- it( 'should not navigate to the cell above but should select the image widget', () => {
|
|
|
+ it( 'should not navigate to the cell above but should put caret at first position of the image caption', () => {
|
|
|
setModelData( model, modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
[ '10', `<image src="${ imageUrl }"><caption>1[]1</caption></image><paragraph>foo</paragraph>`, '12' ],
|
|
|
@@ -2924,12 +2943,12 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', `[<image src="${ imageUrl }"><caption>11</caption></image>]<paragraph>foo</paragraph>`, '12' ],
|
|
|
+ [ '10', `<image src="${ imageUrl }"><caption>[]11</caption></image><paragraph>foo</paragraph>`, '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
} );
|
|
|
|
|
|
- it( 'should not navigate to the cell below when followed by a paragraph', () => {
|
|
|
+ it( 'should not navigate to the cell below when inside the image caption', () => {
|
|
|
setModelData( model, modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
[ '10', `<image src="${ imageUrl }"><caption>1[]1</caption></image><paragraph>foo</paragraph>`, '12' ],
|
|
|
@@ -2938,14 +2957,33 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub );
|
|
|
|
|
|
+ sinon.assert.calledOnce( downArrowDomEvtDataStub.preventDefault );
|
|
|
+ sinon.assert.calledOnce( downArrowDomEvtDataStub.stopPropagation );
|
|
|
+
|
|
|
+ assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
+ [ '00', '01', '02' ],
|
|
|
+ [ '10', `<image src="${ imageUrl }"><caption>11[]</caption></image><paragraph>foo</paragraph>`, '12' ],
|
|
|
+ [ '20', '21', '22' ]
|
|
|
+ ] ) );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should not navigate to the cell below when followed by a paragraph', () => {
|
|
|
+ setModelData( model, modelTable( [
|
|
|
+ [ '00', '01', '02' ],
|
|
|
+ [ '10', `<image src="${ imageUrl }"><caption>11[]</caption></image><paragraph>foo</paragraph>`, '12' ],
|
|
|
+ [ '20', '21', '22' ]
|
|
|
+ ] ) );
|
|
|
+
|
|
|
+ editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub );
|
|
|
+
|
|
|
sinon.assert.notCalled( downArrowDomEvtDataStub.preventDefault );
|
|
|
sinon.assert.notCalled( downArrowDomEvtDataStub.stopPropagation );
|
|
|
} );
|
|
|
|
|
|
- it( 'should not navigate to the cell below but should select the image widget', () => {
|
|
|
+ it( 'should navigate to the cell below if the caret on last position in the image caption', () => {
|
|
|
setModelData( model, modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', `<paragraph>foo</paragraph><image src="${ imageUrl }"><caption>1[]1</caption></image>`, '12' ],
|
|
|
+ [ '10', `<paragraph>foo</paragraph><image src="${ imageUrl }"><caption>11[]</caption></image>`, '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
|
|
|
@@ -2956,22 +2994,21 @@ describe( 'TableKeyboard', () => {
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', `<paragraph>foo</paragraph>[<image src="${ imageUrl }"><caption>11</caption></image>]`, '12' ],
|
|
|
- [ '20', '21', '22' ]
|
|
|
+ [ '10', `<paragraph>foo</paragraph><image src="${ imageUrl }"><caption>11</caption></image>`, '12' ],
|
|
|
+ [ '20', '[]21', '22' ]
|
|
|
] ) );
|
|
|
} );
|
|
|
|
|
|
it( 'should not navigate to the cell above but should select the image widget without caption', () => {
|
|
|
setModelData( model, modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', `<image src="${ imageUrl }"><caption></caption></image><paragraph>f[]oo</paragraph>`, '12' ],
|
|
|
+ [ '10', `<image src="${ imageUrl }"><caption></caption></image><paragraph>[]foo</paragraph>`, '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
|
|
|
editor.editing.view.document.fire( 'keydown', upArrowDomEvtDataStub );
|
|
|
|
|
|
sinon.assert.calledOnce( upArrowDomEvtDataStub.preventDefault );
|
|
|
- sinon.assert.calledOnce( upArrowDomEvtDataStub.stopPropagation );
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
@@ -2983,14 +3020,13 @@ describe( 'TableKeyboard', () => {
|
|
|
it( 'should not navigate to the cell below but should select the image widget without caption', () => {
|
|
|
setModelData( model, modelTable( [
|
|
|
[ '00', '01', '02' ],
|
|
|
- [ '10', `<paragraph>f[]oo</paragraph><image src="${ imageUrl }"><caption></caption></image>`, '12' ],
|
|
|
+ [ '10', `<paragraph>foo[]</paragraph><image src="${ imageUrl }"><caption></caption></image>`, '12' ],
|
|
|
[ '20', '21', '22' ]
|
|
|
] ) );
|
|
|
|
|
|
editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub );
|
|
|
|
|
|
sinon.assert.calledOnce( downArrowDomEvtDataStub.preventDefault );
|
|
|
- sinon.assert.calledOnce( downArrowDomEvtDataStub.stopPropagation );
|
|
|
|
|
|
assertEqualMarkup( getModelData( model ), modelTable( [
|
|
|
[ '00', '01', '02' ],
|