@@ -74,7 +74,7 @@ describe( 'TableEditing', () => {
74
74
expect ( model . schema . checkChild ( [ '$root' , 'table' , 'tableRow' , 'tableCell' ] , '$text' ) ) . to . be . false ;
75
75
expect ( model . schema . checkChild ( [ '$root' , 'table' , 'tableRow' , 'tableCell' ] , '$block' ) ) . to . be . true ;
76
76
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 ;
78
78
} ) ;
79
79
80
80
it ( 'adds insertTable command' , ( ) => {
@@ -183,7 +183,7 @@ describe( 'TableEditing', () => {
183
183
editor . setData ( '<table><tbody><tr><td><img src="sample.png"></td></tr></tbody></table>' ) ;
184
184
185
185
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>' ) ;
187
187
} ) ;
188
188
189
189
it ( 'should convert table with media' , ( ) => {
@@ -312,6 +312,40 @@ describe( 'TableEditing', () => {
312
312
] ) ) ;
313
313
} ) ;
314
314
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
+
315
349
it ( 'should listen with lower priority then its children' , ( ) => {
316
350
// Cancel TAB event.
317
351
editor . keystrokes . set ( 'Tab' , ( data , cancel ) => cancel ( ) ) ;
@@ -461,6 +495,20 @@ describe( 'TableEditing', () => {
461
495
] ,
462
496
] ) ) ;
463
497
} ) ;
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
+ } ) ;
464
512
} ) ;
465
513
} ) ;
466
514
0 commit comments