Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #65 from ckeditor/t/64
Browse files Browse the repository at this point in the history
Internal: Changed `VirtualTestEditor` to `ClassicTestEditor` in enter and shift-enter tests. Closes #64.
  • Loading branch information
Piotr Jasiun authored Jun 25, 2019
2 parents 0891a1d + 286d7c8 commit 6942320
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
19 changes: 15 additions & 4 deletions tests/enter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 );
} );
Expand All @@ -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 } ) );

Expand Down
19 changes: 15 additions & 4 deletions tests/shiftenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 );
} );
Expand All @@ -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 } ) );

Expand Down

0 comments on commit 6942320

Please sign in to comment.