|
@@ -8,6 +8,7 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
import ShiftEnter from '@ckeditor/ckeditor5-enter/src/shiftenter';
|
|
import ShiftEnter from '@ckeditor/ckeditor5-enter/src/shiftenter';
|
|
|
|
|
|
|
|
import { getData } from '../../../src/dev-utils/model';
|
|
import { getData } from '../../../src/dev-utils/model';
|
|
|
|
|
+import TableEditing from '@ckeditor/ckeditor5-table/src/tableediting';
|
|
|
|
|
|
|
|
// NOTE:
|
|
// NOTE:
|
|
|
// dev utils' setData() loses white spaces so don't use it for tests here!!!
|
|
// dev utils' setData() loses white spaces so don't use it for tests here!!!
|
|
@@ -20,7 +21,7 @@ describe( 'DomConverter – whitespace handling – integration', () => {
|
|
|
describe( 'normalizing whitespaces around block boundaries (#822)', () => {
|
|
describe( 'normalizing whitespaces around block boundaries (#822)', () => {
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
|
return VirtualTestEditor
|
|
return VirtualTestEditor
|
|
|
- .create( { plugins: [ Paragraph ] } )
|
|
|
|
|
|
|
+ .create( { plugins: [ Paragraph, TableEditing ] } )
|
|
|
.then( newEditor => {
|
|
.then( newEditor => {
|
|
|
editor = newEditor;
|
|
editor = newEditor;
|
|
|
|
|
|
|
@@ -106,13 +107,31 @@ describe( 'DomConverter – whitespace handling – integration', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
// Controversial result. See https://github.com/ckeditor/ckeditor5-engine/issues/987.
|
|
// Controversial result. See https://github.com/ckeditor/ckeditor5-engine/issues/987.
|
|
|
- it( 'nbsp between blocks is not ignored', () => {
|
|
|
|
|
|
|
+ it( 'nbsp between blocks is not ignored (between paragraphs)', () => {
|
|
|
editor.setData( '<p>foo</p> <p>bar</p>' );
|
|
editor.setData( '<p>foo</p> <p>bar</p>' );
|
|
|
|
|
|
|
|
expect( getData( editor.model, { withoutSelection: true } ) )
|
|
expect( getData( editor.model, { withoutSelection: true } ) )
|
|
|
- .to.equal( '<paragraph>foo</paragraph><paragraph>bar</paragraph>' );
|
|
|
|
|
|
|
+ .to.equal( '<paragraph>foo</paragraph><paragraph> </paragraph><paragraph>bar</paragraph>' );
|
|
|
|
|
|
|
|
- expect( editor.getData() ).to.equal( '<p>foo</p><p>bar</p>' );
|
|
|
|
|
|
|
+ expect( editor.getData() ).to.equal( '<p>foo</p><p> </p><p>bar</p>' );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'nbsp between blocks is not ignored (different blocks)', () => {
|
|
|
|
|
+ editor.setData( '<table><tr><td>foo</td></tr></table> <p>bar</p>' );
|
|
|
|
|
+
|
|
|
|
|
+ expect( getData( editor.model, { withoutSelection: true } ) )
|
|
|
|
|
+ .to.equal(
|
|
|
|
|
+ '<table><tableRow><tableCell><paragraph>foo</paragraph></tableCell></tableRow></table>' +
|
|
|
|
|
+ '<paragraph> </paragraph>' +
|
|
|
|
|
+ '<paragraph>bar</paragraph>'
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ expect( editor.getData() )
|
|
|
|
|
+ .to.equal(
|
|
|
|
|
+ '<figure class="table"><table><tbody><tr><td>foo</td></tr></tbody></table></figure>' +
|
|
|
|
|
+ '<p> </p>' +
|
|
|
|
|
+ '<p>bar</p>'
|
|
|
|
|
+ );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'new lines inside blocks are ignored', () => {
|
|
it( 'new lines inside blocks are ignored', () => {
|