8
0
فهرست منبع

Tests: Aligned table tests to the WidgetTypeAround feature.

Aleksander Nowodzinski 5 سال پیش
والد
کامیت
d3330244fa

+ 7 - 3
packages/ckeditor5-table/tests/converters/upcasttable.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
  */
 
 
-import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import { getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
@@ -17,8 +17,8 @@ describe( 'upcastTable()', () => {
 	let editor, model;
 	let editor, model;
 
 
 	beforeEach( () => {
 	beforeEach( () => {
-		return VirtualTestEditor
-			.create( {
+		return ClassicTestEditor
+			.create( '', {
 				plugins: [ TableEditing, Paragraph, ImageEditing, Widget ]
 				plugins: [ TableEditing, Paragraph, ImageEditing, Widget ]
 			} )
 			} )
 			.then( newEditor => {
 			.then( newEditor => {
@@ -31,6 +31,10 @@ describe( 'upcastTable()', () => {
 			} );
 			} );
 	} );
 	} );
 
 
+	afterEach( () => {
+		editor.destroy();
+	} );
+
 	function expectModel( data ) {
 	function expectModel( data ) {
 		assertEqualMarkup( getModelData( model, { withoutSelection: true } ), data );
 		assertEqualMarkup( getModelData( model, { withoutSelection: true } ), data );
 	}
 	}

+ 19 - 7
packages/ckeditor5-table/tests/table-integration.js

@@ -11,7 +11,7 @@ import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
 import ListEditing from '@ckeditor/ckeditor5-list/src/listediting';
 import ListEditing from '@ckeditor/ckeditor5-list/src/listediting';
 import BlockQuoteEditing from '@ckeditor/ckeditor5-block-quote/src/blockquoteediting';
 import BlockQuoteEditing from '@ckeditor/ckeditor5-block-quote/src/blockquoteediting';
 import Typing from '@ckeditor/ckeditor5-typing/src/typing';
 import Typing from '@ckeditor/ckeditor5-typing/src/typing';
-import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import {
 import {
 	getData as getModelData,
 	getData as getModelData,
 	setData as setModelData
 	setData as setModelData
@@ -27,14 +27,18 @@ describe( 'Table feature – integration', () => {
 		let editor, clipboard;
 		let editor, clipboard;
 
 
 		beforeEach( () => {
 		beforeEach( () => {
-			return VirtualTestEditor
-				.create( { plugins: [ Paragraph, TableEditing, ListEditing, BlockQuoteEditing, Widget, Clipboard ] } )
+			return ClassicTestEditor
+				.create( '', { plugins: [ Paragraph, TableEditing, ListEditing, BlockQuoteEditing, Widget, Clipboard ] } )
 				.then( newEditor => {
 				.then( newEditor => {
 					editor = newEditor;
 					editor = newEditor;
 					clipboard = editor.plugins.get( 'Clipboard' );
 					clipboard = editor.plugins.get( 'Clipboard' );
 				} );
 				} );
 		} );
 		} );
 
 
+		afterEach( () => {
+			editor.destroy();
+		} );
+
 		it( 'pastes td as p when pasting into the table', () => {
 		it( 'pastes td as p when pasting into the table', () => {
 			setModelData( editor.model, modelTable( [ [ 'foo[]' ] ] ) );
 			setModelData( editor.model, modelTable( [ [ 'foo[]' ] ] ) );
 
 
@@ -86,8 +90,8 @@ describe( 'Table feature – integration', () => {
 		let editor, doc, root;
 		let editor, doc, root;
 
 
 		beforeEach( () => {
 		beforeEach( () => {
-			return VirtualTestEditor
-				.create( { plugins: [ Paragraph, TableEditing, Widget, UndoEditing ] } )
+			return ClassicTestEditor
+				.create( '', { plugins: [ Paragraph, TableEditing, Widget, UndoEditing ] } )
 				.then( newEditor => {
 				.then( newEditor => {
 					editor = newEditor;
 					editor = newEditor;
 					doc = editor.model.document;
 					doc = editor.model.document;
@@ -95,6 +99,10 @@ describe( 'Table feature – integration', () => {
 				} );
 				} );
 		} );
 		} );
 
 
+		afterEach( () => {
+			editor.destroy();
+		} );
+
 		it( 'fixing empty roots should be transparent to undo', () => {
 		it( 'fixing empty roots should be transparent to undo', () => {
 			expect( editor.getData( { trim: 'none' } ) ).to.equal( '<p>&nbsp;</p>' );
 			expect( editor.getData( { trim: 'none' } ) ).to.equal( '<p>&nbsp;</p>' );
 			expect( editor.commands.get( 'undo' ).isEnabled ).to.be.false;
 			expect( editor.commands.get( 'undo' ).isEnabled ).to.be.false;
@@ -155,13 +163,17 @@ describe( 'Table feature – integration', () => {
 		let editor;
 		let editor;
 
 
 		beforeEach( () => {
 		beforeEach( () => {
-			return VirtualTestEditor
-				.create( { plugins: [ Paragraph, TableEditing, ListEditing, BlockQuoteEditing, Widget, Typing ] } )
+			return ClassicTestEditor
+				.create( '', { plugins: [ Paragraph, TableEditing, ListEditing, BlockQuoteEditing, Widget, Typing ] } )
 				.then( newEditor => {
 				.then( newEditor => {
 					editor = newEditor;
 					editor = newEditor;
 				} );
 				} );
 		} );
 		} );
 
 
+		afterEach( () => {
+			editor.destroy();
+		} );
+
 		it( 'merges elements without throwing errors', () => {
 		it( 'merges elements without throwing errors', () => {
 			setModelData( editor.model, modelTable( [
 			setModelData( editor.model, modelTable( [
 				[ '<blockQuote><paragraph>Foo</paragraph></blockQuote><paragraph>[]Bar</paragraph>' ]
 				[ '<blockQuote><paragraph>Foo</paragraph></blockQuote><paragraph>[]Bar</paragraph>' ]

+ 3 - 0
packages/ckeditor5-table/tests/tablekeyboard.js

@@ -2769,6 +2769,9 @@ describe( 'TableKeyboard', () => {
 							[ '20', '21', '22' ]
 							[ '20', '21', '22' ]
 						] ) );
 						] ) );
 
 
+						// Note: Two keydowns are necessary because the first one is handled by the WidgetTypeAround plugin
+						// to activate the "fake caret".
+						editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub );
 						editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub );
 						editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub );
 
 
 						assertEqualMarkup( getModelData( model ), modelTable( [
 						assertEqualMarkup( getModelData( model ), modelTable( [