diff --git a/tests/enter.js b/tests/enter.js index b45ab55..7d2afc8 100644 --- a/tests/enter.js +++ b/tests/enter.js @@ -3,18 +3,23 @@ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; +/* globals document */ + +import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import Enter from '../src/enter'; import EnterCommand from '../src/entercommand'; import EnterObserver from '../src/enterobserver'; import DomEventData from '@ckeditor/ckeditor5-engine/src/view/observer/domeventdata'; describe( 'Enter feature', () => { - let editor, viewDocument; + let element, editor, viewDocument; beforeEach( () => { - return VirtualTestEditor - .create( { + element = document.createElement( 'div' ); + document.body.appendChild( element ); + + return ClassicTestEditor + .create( element, { plugins: [ Enter ] } ) .then( newEditor => { @@ -23,6 +28,11 @@ describe( 'Enter feature', () => { } ); } ); + afterEach( () => { + element.remove(); + sinon.restore(); + } ); + it( 'creates the commands', () => { expect( editor.commands.get( 'enter' ) ).to.be.instanceof( EnterCommand ); } ); @@ -36,6 +46,7 @@ describe( 'Enter feature', () => { it( 'listens to the editing view enter event', () => { const spy = editor.execute = sinon.spy(); const domEvt = getDomEvent(); + sinon.stub( editor.editing.view, 'scrollToTheSelection' ); viewDocument.fire( 'enter', new DomEventData( viewDocument, domEvt, { isSoft: false } ) ); diff --git a/tests/shiftenter.js b/tests/shiftenter.js index 62a7c07..14593bf 100644 --- a/tests/shiftenter.js +++ b/tests/shiftenter.js @@ -3,18 +3,23 @@ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; +/* globals document */ + +import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import ShiftEnter from '../src/shiftenter'; import ShiftEnterCommand from '../src/shiftentercommand'; import EnterObserver from '../src/enterobserver'; import DomEventData from '@ckeditor/ckeditor5-engine/src/view/observer/domeventdata'; describe( 'ShiftEnter feature', () => { - let editor, viewDocument; + let element, editor, viewDocument; beforeEach( () => { - return VirtualTestEditor - .create( { + element = document.createElement( 'div' ); + document.body.appendChild( element ); + + return ClassicTestEditor + .create( element, { plugins: [ ShiftEnter ] } ) .then( newEditor => { @@ -23,6 +28,11 @@ describe( 'ShiftEnter feature', () => { } ); } ); + afterEach( () => { + element.remove(); + sinon.restore(); + } ); + it( 'creates the commands', () => { expect( editor.commands.get( 'shiftEnter' ) ).to.be.instanceof( ShiftEnterCommand ); } ); @@ -44,6 +54,7 @@ describe( 'ShiftEnter feature', () => { it( 'listens to the editing view enter event', () => { const spy = editor.execute = sinon.spy(); const domEvt = getDomEvent(); + sinon.stub( editor.editing.view, 'scrollToTheSelection' ); viewDocument.fire( 'enter', new DomEventData( viewDocument, domEvt, { isSoft: true } ) );