Browse Source

Use IndentEditing in tests that does not require UI.

Maciej Gołaszewski 6 years ago
parent
commit
19e4ff7644

+ 0 - 8
packages/ckeditor5-indent/src/indentblock.js

@@ -8,7 +8,6 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import Indent from '@ckeditor/ckeditor5-core/src/indent';
 
 import IndentBlockCommand from './indentblockcommand';
 import IndentUsingOffset from './indentcommandbehavior/indentusingoffset';
@@ -47,13 +46,6 @@ export default class IndentBlock extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
-	static get requires() {
-		return [ Indent ];
-	}
-
-	/**
-	 * @inheritDoc
-	 */
 	init() {
 		const editor = this.editor;
 		const schema = editor.model.schema;

+ 8 - 17
packages/ckeditor5-indent/tests/indentblock-integration.js

@@ -3,30 +3,21 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-/* global document */
-
-import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import Indent from '@ckeditor/ckeditor5-core/src/indent';
-import Heading from '@ckeditor/ckeditor5-heading/src/heading';
+import IndentEditing from '@ckeditor/ckeditor5-core/src/indentediting';
+import HeadingEditing from '@ckeditor/ckeditor5-heading/src/headingediting';
 
 import IndentBlock from '../src/indentblock';
 
 describe( 'IndentBlock - integration', () => {
-	let editor, element, model, doc;
+	let editor, model, doc;
 
 	testUtils.createSinonSandbox();
 
-	beforeEach( () => {
-		element = document.createElement( 'div' );
-		document.body.appendChild( element );
-	} );
-
 	afterEach( () => {
-		element.remove();
-
 		if ( editor ) {
 			return editor.destroy();
 		}
@@ -59,7 +50,7 @@ describe( 'IndentBlock - integration', () => {
 	describe( 'with heading', () => {
 		beforeEach( () => {
 			return createTestEditor( {
-				plugins: [ Paragraph, Heading, Indent, IndentBlock ],
+				plugins: [ Paragraph, HeadingEditing, IndentEditing, IndentBlock ],
 				indentBlock: { offset: 50, unit: 'px' }
 			} ).then( newEditor => {
 				editor = newEditor;
@@ -83,9 +74,9 @@ describe( 'IndentBlock - integration', () => {
 	} );
 
 	function createTestEditor( extraConfig = {} ) {
-		return ClassicTestEditor
-			.create( element, Object.assign( {
-				plugins: [ Paragraph, Indent, IndentBlock ]
+		return VirtualTestEditor
+			.create( Object.assign( {
+				plugins: [ Paragraph, IndentEditing, IndentBlock ]
 			}, extraConfig ) );
 	}
 } );

+ 6 - 16
packages/ckeditor5-indent/tests/indentblock.js

@@ -3,33 +3,23 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-/* global document */
-
-import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import HeadingEditing from '@ckeditor/ckeditor5-heading/src/headingediting';
-
+import IndentEditing from '@ckeditor/ckeditor5-core/src/indentediting';
 import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
-import Indent from '@ckeditor/ckeditor5-core/src/indent';
 
 import IndentBlock from '../src/indentblock';
 import IndentBlockCommand from '../src/indentblockcommand';
 
 describe( 'IndentBlock', () => {
-	let editor, element, model, doc;
+	let editor, model, doc;
 
 	testUtils.createSinonSandbox();
 
-	beforeEach( () => {
-		element = document.createElement( 'div' );
-		document.body.appendChild( element );
-	} );
-
 	afterEach( () => {
-		element.remove();
-
 		if ( editor ) {
 			return editor.destroy();
 		}
@@ -309,9 +299,9 @@ describe( 'IndentBlock', () => {
 	} );
 
 	function createTestEditor( extraConfig = {} ) {
-		return ClassicTestEditor
-			.create( element, Object.assign( {
-				plugins: [ Paragraph, HeadingEditing, Indent, IndentBlock ]
+		return VirtualTestEditor
+			.create( Object.assign( {
+				plugins: [ Paragraph, HeadingEditing, IndentEditing, IndentBlock ]
 			}, extraConfig ) );
 	}
 } );

+ 4 - 3
packages/ckeditor5-indent/tests/manual/indent-block.js

@@ -7,13 +7,14 @@
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 
-import IndentBlock from '../../src/indentblock';
-
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
+import Indent from '@ckeditor/ckeditor5-core/src/indent';
+
+import IndentBlock from '../../src/indentblock';
 
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ ArticlePluginSet, IndentBlock ],
+		plugins: [ ArticlePluginSet, Indent, IndentBlock ],
 		toolbar: [
 			'heading',
 			'|',