|
@@ -3,18 +3,16 @@
|
|
|
* For licensing, see LICENSE.md.
|
|
* For licensing, see LICENSE.md.
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
|
|
|
|
|
|
|
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
|
|
|
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
|
|
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
|
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
|
|
+import List from '@ckeditor/ckeditor5-list/src/list';
|
|
|
import Bold from '@ckeditor/ckeditor5-basic-styles/src/boldengine';
|
|
import Bold from '@ckeditor/ckeditor5-basic-styles/src/boldengine';
|
|
|
import Input from '../src/input';
|
|
import Input from '../src/input';
|
|
|
|
|
|
|
|
import Writer from '@ckeditor/ckeditor5-engine/src/model/writer';
|
|
import Writer from '@ckeditor/ckeditor5-engine/src/model/writer';
|
|
|
import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range';
|
|
import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range';
|
|
|
|
|
|
|
|
-import { downcastElementToElement } from '@ckeditor/ckeditor5-engine/src/conversion/downcast-converters';
|
|
|
|
|
-import { upcastElementToElement } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
|
|
|
|
|
-
|
|
|
|
|
import ViewText from '@ckeditor/ckeditor5-engine/src/view/text';
|
|
import ViewText from '@ckeditor/ckeditor5-engine/src/view/text';
|
|
|
import ViewElement from '@ckeditor/ckeditor5-engine/src/view/element';
|
|
import ViewElement from '@ckeditor/ckeditor5-engine/src/view/element';
|
|
|
import ViewSelection from '@ckeditor/ckeditor5-engine/src/view/selection';
|
|
import ViewSelection from '@ckeditor/ckeditor5-engine/src/view/selection';
|
|
@@ -25,31 +23,28 @@ import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
|
|
|
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
|
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
|
|
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
|
|
|
|
|
|
|
|
|
|
+/* global document */
|
|
|
|
|
+
|
|
|
describe( 'Input feature', () => {
|
|
describe( 'Input feature', () => {
|
|
|
let editor, model, modelRoot, view, viewDocument, viewRoot, listenter;
|
|
let editor, model, modelRoot, view, viewDocument, viewRoot, listenter;
|
|
|
|
|
|
|
|
testUtils.createSinonSandbox();
|
|
testUtils.createSinonSandbox();
|
|
|
|
|
|
|
|
- before( () => {
|
|
|
|
|
|
|
+ beforeEach( () => {
|
|
|
listenter = Object.create( EmitterMixin );
|
|
listenter = Object.create( EmitterMixin );
|
|
|
|
|
|
|
|
- return VirtualTestEditor
|
|
|
|
|
- .create( {
|
|
|
|
|
- plugins: [ Input, Paragraph, Bold ]
|
|
|
|
|
- } )
|
|
|
|
|
|
|
+ const domElement = document.createElement( 'div' );
|
|
|
|
|
+ document.body.appendChild( domElement );
|
|
|
|
|
+
|
|
|
|
|
+ return ClassicTestEditor.create( domElement, { plugins: [ Input, Paragraph, Bold, List ] } )
|
|
|
.then( newEditor => {
|
|
.then( newEditor => {
|
|
|
// Mock image feature.
|
|
// Mock image feature.
|
|
|
newEditor.model.schema.register( 'image', { allowWhere: '$text' } );
|
|
newEditor.model.schema.register( 'image', { allowWhere: '$text' } );
|
|
|
|
|
|
|
|
- newEditor.conversion.for( 'downcast' ).add( downcastElementToElement( {
|
|
|
|
|
|
|
+ newEditor.conversion.elementToElement( {
|
|
|
model: 'image',
|
|
model: 'image',
|
|
|
view: 'img'
|
|
view: 'img'
|
|
|
- } ) );
|
|
|
|
|
-
|
|
|
|
|
- newEditor.conversion.for( 'upcast' ).add( upcastElementToElement( {
|
|
|
|
|
- view: 'img',
|
|
|
|
|
- model: 'image'
|
|
|
|
|
- } ) );
|
|
|
|
|
|
|
+ } );
|
|
|
|
|
|
|
|
editor = newEditor;
|
|
editor = newEditor;
|
|
|
model = editor.model;
|
|
model = editor.model;
|