|
|
@@ -17,8 +17,6 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest
|
|
|
import { getData as getModelData, parse as parseModel, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
|
import { getData as getViewData, parse as parseView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
|
|
|
|
|
|
-import { insertElement } from '@ckeditor/ckeditor5-engine/src/conversion/downcast-converters';
|
|
|
-import { upcastElementToElement } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
|
|
|
import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
|
|
|
|
|
|
describe( 'ListEditing', () => {
|
|
|
@@ -345,6 +343,10 @@ describe( 'ListEditing', () => {
|
|
|
'<p>foo</p><ul><li>xxx</li><li>yyy</li></ul>'
|
|
|
);
|
|
|
|
|
|
+ // #ckeditor5/1399
|
|
|
+ test( 'single item with `font-weight` style',
|
|
|
+ '<ol><li style="font-weight: bold">foo</li></ol>', '<ol><li><strong>foo</strong></li></ol>' );
|
|
|
+
|
|
|
it( 'model test for mixed content', () => {
|
|
|
editor.setData( '<ol><li>a</li></ol><p>xxx</p><ul><li>b</li><li>c</li></ul><p>yyy</p><ul><li>d</li></ul>' );
|
|
|
|
|
|
@@ -3813,12 +3815,11 @@ describe( 'ListEditing', () => {
|
|
|
editor.editing.downcastDispatcher.on( 'insert:listItem', ( evt, data, conversionApi ) => {
|
|
|
conversionApi.consumable.consume( data.item, 'attribute:listType' );
|
|
|
conversionApi.consumable.consume( data.item, 'attribute:listIndent' );
|
|
|
-
|
|
|
- const converter = insertElement( ( modelElement, viewWriter ) => viewWriter.createContainerElement( 'p' ) );
|
|
|
-
|
|
|
- return converter( evt, data, conversionApi );
|
|
|
}, { priority: 'highest' } );
|
|
|
|
|
|
+ editor.conversion.for( 'downcast' )
|
|
|
+ .elementToElement( { model: 'listItem', view: 'p', converterPriority: 'highest' } );
|
|
|
+
|
|
|
// Paragraph is needed, otherwise selection throws.
|
|
|
setModelData( model, '<paragraph>x</paragraph><listItem listIndent="0" listType="bulleted">y</listItem>' );
|
|
|
|
|
|
@@ -4022,7 +4023,7 @@ describe( 'ListEditing', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'should split parent element when one of modelCursor ancestors allows to insert list - in the middle', () => {
|
|
|
- editor.conversion.for( 'upcast' ).add( upcastElementToElement( { view: 'div', model: 'div' } ) );
|
|
|
+ editor.conversion.for( 'upcast' ).elementToElement( { view: 'div', model: 'div' } );
|
|
|
model.schema.register( 'div', { inheritAllFrom: '$block' } );
|
|
|
|
|
|
editor.setData(
|
|
|
@@ -4043,7 +4044,7 @@ describe( 'ListEditing', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'should split parent element when one of modelCursor ancestors allows to insert list - at the end', () => {
|
|
|
- editor.conversion.for( 'upcast' ).add( upcastElementToElement( { view: 'div', model: 'div' } ) );
|
|
|
+ editor.conversion.for( 'upcast' ).elementToElement( { view: 'div', model: 'div' } );
|
|
|
model.schema.register( 'div', { inheritAllFrom: '$block' } );
|
|
|
|
|
|
editor.setData(
|
|
|
@@ -4062,7 +4063,7 @@ describe( 'ListEditing', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'should split parent element when one of modelCursor ancestors allows to insert list - at the beginning', () => {
|
|
|
- editor.conversion.for( 'upcast' ).add( upcastElementToElement( { view: 'div', model: 'div' } ) );
|
|
|
+ editor.conversion.for( 'upcast' ).elementToElement( { view: 'div', model: 'div' } );
|
|
|
model.schema.register( 'div', { inheritAllFrom: '$block' } );
|
|
|
|
|
|
editor.setData(
|