From 244e240b6e71faf66c9fe31ec2b8c9ee4c62e4fe Mon Sep 17 00:00:00 2001 From: Szymon Cofalik Date: Tue, 22 Aug 2017 11:16:00 +0200 Subject: [PATCH] Tests: Used ClassicEditor to ensure proper integration tests environment. --- tests/undoengine-integration.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/undoengine-integration.js b/tests/undoengine-integration.js index a242a0b..c710ebd 100644 --- a/tests/undoengine-integration.js +++ b/tests/undoengine-integration.js @@ -3,7 +3,10 @@ * For licensing, see LICENSE.md. */ -import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; +/* global document */ + +import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; + import Range from '@ckeditor/ckeditor5-engine/src/model/range'; import Position from '@ckeditor/ckeditor5-engine/src/model/position'; import UndoEngine from '../src/undoengine'; @@ -21,10 +24,13 @@ import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildv import { setData, getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; describe( 'UndoEngine integration', () => { - let editor, doc, root; + let editor, doc, root, div; beforeEach( () => { - return VirtualTestEditor.create( { plugins: [ Paragraph, HeadingEngine, Typing, Enter, Clipboard, BoldEngine, UndoEngine ] } ) + div = document.createElement( 'div' ); + document.body.appendChild( div ); + + return ClassicEditor.create( div, { plugins: [ Paragraph, HeadingEngine, Typing, Enter, Clipboard, BoldEngine, UndoEngine ] } ) .then( newEditor => { editor = newEditor; @@ -795,12 +801,20 @@ describe( 'UndoEngine integration', () => { // ckeditor5-engine#t/1065 it( 'undo paste into non empty element should not throw and be correct', () => { - input( 'Foo[]' ); + doc.enqueueChanges( () => { + input( 'Foo[]' ); + } ); + + doc.enqueueChanges( () => { + pasteHtml( editor, '

a

b

' ); + } ); - pasteHtml( editor, '

a

b

' ); output( 'Fooab[]' ); - pasteHtml( editor, '

c

d

' ); + doc.enqueueChanges( () => { + pasteHtml( editor, '

c

d

' ); + } ); + output( 'Fooabcd[]' ); editor.execute( 'undo' );