@@ -13,6 +13,7 @@ import List from '@ckeditor/ckeditor5-list/src/list';
1313import Enter from '@ckeditor/ckeditor5-enter/src/enter' ;
1414import Delete from '@ckeditor/ckeditor5-typing/src/delete' ;
1515import Heading from '@ckeditor/ckeditor5-heading/src/heading' ;
16+ import Table from '@ckeditor/ckeditor5-table/src/table' ;
1617
1718import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor' ;
1819import {
@@ -30,7 +31,7 @@ describe( 'BlockQuote integration', () => {
3031
3132 return ClassicTestEditor
3233 . create ( element , {
33- plugins : [ BlockQuote , Paragraph , Image , ImageCaption , List , Enter , Delete , Heading ]
34+ plugins : [ BlockQuote , Paragraph , Image , ImageCaption , List , Enter , Delete , Heading , Table ]
3435 } )
3536 . then ( newEditor => {
3637 editor = newEditor ;
@@ -418,4 +419,52 @@ describe( 'BlockQuote integration', () => {
418419 ) ;
419420 } ) ;
420421 } ) ;
422+
423+ describe ( 'compatibility with tables' , ( ) => {
424+ it ( 'wraps whole table' , ( ) => {
425+ setModelData ( model , '[<table><tableRow><tableCell><paragraph>foo</paragraph></tableCell></tableRow></table>]' ) ;
426+
427+ editor . execute ( 'blockQuote' ) ;
428+
429+ expect ( getModelData ( model ) ) . to . equal (
430+ '<blockQuote>[<table><tableRow><tableCell><paragraph>foo</paragraph></tableCell></tableRow></table>]</blockQuote>'
431+ ) ;
432+ } ) ;
433+
434+ it ( 'unwraps whole table' , ( ) => {
435+ setModelData (
436+ model ,
437+ '<blockQuote>[<table><tableRow><tableCell><paragraph>foo</paragraph></tableCell></tableRow></table>]</blockQuote>'
438+ ) ;
439+
440+ editor . execute ( 'blockQuote' ) ;
441+
442+ expect ( getModelData ( model ) ) . to . equal (
443+ '[<table><tableRow><tableCell><paragraph>foo</paragraph></tableCell></tableRow></table>]'
444+ ) ;
445+ } ) ;
446+
447+ it ( 'wraps table cell paragraph' , ( ) => {
448+ setModelData ( model , '<table><tableRow><tableCell><paragraph>[]foo</paragraph></tableCell></tableRow></table>' ) ;
449+
450+ editor . execute ( 'blockQuote' ) ;
451+
452+ expect ( getModelData ( model ) ) . to . equal (
453+ '<table><tableRow><tableCell><blockQuote><paragraph>[]foo</paragraph></blockQuote></tableCell></tableRow></table>'
454+ ) ;
455+ } ) ;
456+
457+ it ( 'unwraps table cell paragraph' , ( ) => {
458+ setModelData (
459+ model ,
460+ '<table><tableRow><tableCell><blockQuote><paragraph>[]foo</paragraph></blockQuote></tableCell></tableRow></table>'
461+ ) ;
462+
463+ editor . execute ( 'blockQuote' ) ;
464+
465+ expect ( getModelData ( model ) ) . to . equal (
466+ '<table><tableRow><tableCell><paragraph>[]foo</paragraph></tableCell></tableRow></table>'
467+ ) ;
468+ } ) ;
469+ } ) ;
421470} ) ;
0 commit comments