|
|
@@ -14,6 +14,7 @@ import CommandCollection from '../../src/commandcollection';
|
|
|
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
|
import Locale from '@ckeditor/ckeditor5-utils/src/locale';
|
|
|
import Command from '../../src/command';
|
|
|
+import EditingKeystrokeHandler from '../../src/editingkeystrokehandler';
|
|
|
|
|
|
class PluginA extends Plugin {
|
|
|
constructor( editor ) {
|
|
|
@@ -105,6 +106,7 @@ describe( 'Editor', () => {
|
|
|
expect( editor.config ).to.be.an.instanceof( Config );
|
|
|
expect( editor.commands ).to.be.an.instanceof( CommandCollection );
|
|
|
expect( editor.editing ).to.be.instanceof( EditingController );
|
|
|
+ expect( editor.keystrokes ).to.be.instanceof( EditingKeystrokeHandler );
|
|
|
|
|
|
expect( editor.plugins ).to.be.an.instanceof( PluginCollection );
|
|
|
expect( getPlugins( editor ) ).to.be.empty;
|
|
|
@@ -153,6 +155,13 @@ describe( 'Editor', () => {
|
|
|
|
|
|
expect( editor.model.document.hasRoot( 'main' ) ).to.true;
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'should activate #keystrokes', () => {
|
|
|
+ const spy = sinon.spy( EditingKeystrokeHandler.prototype, 'listenTo' );
|
|
|
+ const editor = new Editor();
|
|
|
+
|
|
|
+ sinon.assert.calledWith( spy, editor.editing.view );
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
describe( 'plugins', () => {
|
|
|
@@ -212,17 +221,19 @@ describe( 'Editor', () => {
|
|
|
it( 'should destroy all components it initialized', () => {
|
|
|
const editor = new Editor();
|
|
|
|
|
|
- const spy1 = sinon.spy( editor.data, 'destroy' );
|
|
|
- const spy2 = sinon.spy( editor.model, 'destroy' );
|
|
|
- const spy3 = sinon.spy( editor.editing, 'destroy' );
|
|
|
- const spy4 = sinon.spy( editor.plugins, 'destroy' );
|
|
|
+ const dataDestroySpy = sinon.spy( editor.data, 'destroy' );
|
|
|
+ const modelDestroySpy = sinon.spy( editor.model, 'destroy' );
|
|
|
+ const editingDestroySpy = sinon.spy( editor.editing, 'destroy' );
|
|
|
+ const pluginsDestroySpy = sinon.spy( editor.plugins, 'destroy' );
|
|
|
+ const keystrokesDestroySpy = sinon.spy( editor.keystrokes, 'destroy' );
|
|
|
|
|
|
return editor.destroy()
|
|
|
.then( () => {
|
|
|
- expect( spy1.calledOnce ).to.be.true;
|
|
|
- expect( spy2.calledOnce ).to.be.true;
|
|
|
- expect( spy3.calledOnce ).to.be.true;
|
|
|
- expect( spy4.calledOnce ).to.be.true;
|
|
|
+ sinon.assert.calledOnce( dataDestroySpy );
|
|
|
+ sinon.assert.calledOnce( modelDestroySpy );
|
|
|
+ sinon.assert.calledOnce( editingDestroySpy );
|
|
|
+ sinon.assert.calledOnce( pluginsDestroySpy );
|
|
|
+ sinon.assert.calledOnce( keystrokesDestroySpy );
|
|
|
} );
|
|
|
} );
|
|
|
} );
|