@@ -74,7 +74,7 @@ describe( 'TableEditing', () => {
7474 expect ( model . schema . checkChild ( [ '$root' , 'table' , 'tableRow' , 'tableCell' ] , '$text' ) ) . to . be . false ;
7575 expect ( model . schema . checkChild ( [ '$root' , 'table' , 'tableRow' , 'tableCell' ] , '$block' ) ) . to . be . true ;
7676 expect ( model . schema . checkChild ( [ '$root' , 'table' , 'tableRow' , 'tableCell' ] , 'table' ) ) . to . be . false ;
77- expect ( model . schema . checkChild ( [ '$root' , 'table' , 'tableRow' , 'tableCell' ] , 'image' ) ) . to . be . false ;
77+ expect ( model . schema . checkChild ( [ '$root' , 'table' , 'tableRow' , 'tableCell' ] , 'image' ) ) . to . be . true ;
7878 } ) ;
7979
8080 it ( 'adds insertTable command' , ( ) => {
@@ -183,7 +183,7 @@ describe( 'TableEditing', () => {
183183 editor . setData ( '<table><tbody><tr><td><img src="sample.png"></td></tr></tbody></table>' ) ;
184184
185185 expect ( getModelData ( model , { withoutSelection : true } ) )
186- . to . equal ( '<table><tableRow><tableCell><paragraph ></paragraph ></tableCell></tableRow></table>' ) ;
186+ . to . equal ( '<table><tableRow><tableCell><image src="sample.png" ></image ></tableCell></tableRow></table>' ) ;
187187 } ) ;
188188
189189 it ( 'should convert table with media' , ( ) => {
@@ -312,6 +312,40 @@ describe( 'TableEditing', () => {
312312 ] ) ) ;
313313 } ) ;
314314
315+ it ( 'should move to next cell with an image' , ( ) => {
316+ setModelData ( model , modelTable ( [
317+ [ '11[]' , '<paragraph>foo</paragraph><image></image>' ]
318+ ] ) ) ;
319+
320+ editor . editing . view . document . fire ( 'keydown' , domEvtDataStub ) ;
321+
322+ sinon . assert . calledOnce ( domEvtDataStub . preventDefault ) ;
323+ sinon . assert . calledOnce ( domEvtDataStub . stopPropagation ) ;
324+ expect ( formatTable ( getModelData ( model ) ) ) . to . equal ( formattedModelTable ( [
325+ [ '11' , '<paragraph>[foo</paragraph><image></image>]' ]
326+ ] ) ) ;
327+ } ) ;
328+
329+ it ( 'should move to next cell with an blockQuote' , ( ) => {
330+ model . schema . register ( 'blockQuote' , {
331+ allowWhere : '$block' ,
332+ allowContentOf : '$root'
333+ } ) ;
334+ editor . conversion . elementToElement ( { model : 'blockQuote' , view : 'blockquote' } ) ;
335+
336+ setModelData ( model , modelTable ( [
337+ [ '11[]' , '<blockQuote><paragraph>foo</paragraph></blockQuote>' ]
338+ ] ) ) ;
339+
340+ editor . editing . view . document . fire ( 'keydown' , domEvtDataStub ) ;
341+
342+ sinon . assert . calledOnce ( domEvtDataStub . preventDefault ) ;
343+ sinon . assert . calledOnce ( domEvtDataStub . stopPropagation ) ;
344+ expect ( formatTable ( getModelData ( model ) ) ) . to . equal ( formattedModelTable ( [
345+ [ '11' , '<blockQuote><paragraph>[foo]</paragraph></blockQuote>' ]
346+ ] ) ) ;
347+ } ) ;
348+
315349 it ( 'should listen with lower priority then its children' , ( ) => {
316350 // Cancel TAB event.
317351 editor . keystrokes . set ( 'Tab' , ( data , cancel ) => cancel ( ) ) ;
@@ -461,6 +495,20 @@ describe( 'TableEditing', () => {
461495 ] ,
462496 ] ) ) ;
463497 } ) ;
498+
499+ it ( 'should move to previous cell with an image' , ( ) => {
500+ setModelData ( model , modelTable ( [
501+ [ '<paragraph>foo</paragraph><image></image>' , 'bar[]' ]
502+ ] ) ) ;
503+
504+ editor . editing . view . document . fire ( 'keydown' , domEvtDataStub ) ;
505+
506+ sinon . assert . calledOnce ( domEvtDataStub . preventDefault ) ;
507+ sinon . assert . calledOnce ( domEvtDataStub . stopPropagation ) ;
508+ expect ( formatTable ( getModelData ( model ) ) ) . to . equal ( formattedModelTable ( [
509+ [ '<paragraph>[foo</paragraph><image></image>]' , 'bar' ]
510+ ] ) ) ;
511+ } ) ;
464512 } ) ;
465513 } ) ;
466514
0 commit comments