8
0
Просмотр исходного кода

Simplified the UI of ClassicTestEditor.

Oskar Wróbel 7 лет назад
Родитель
Сommit
438c7a2195

+ 3 - 3
packages/ckeditor5-core/tests/_utils-tests/classictesteditor.js

@@ -11,7 +11,7 @@ import ClassicTestEditor from '../../tests/_utils/classictesteditor';
 import Plugin from '../../src/plugin';
 import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
 
-import ClassicTestEditorUI from '../../tests/_utils/classictesteditorui';
+import EditorUI from '../../src/editor/editorui';
 import BoxedEditorUIView from '@ckeditor/ckeditor5-ui/src/editorui/boxed/boxededitoruiview';
 import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview';
 
@@ -39,7 +39,7 @@ describe( 'ClassicTestEditor', () => {
 			expect( editor ).to.be.instanceof( Editor );
 			expect( editor.config.get( 'foo' ) ).to.equal( 1 );
 			expect( editor.element ).to.equal( editorElement );
-			expect( editor.ui ).to.be.instanceOf( ClassicTestEditorUI );
+			expect( editor.ui ).to.be.instanceOf( EditorUI );
 			expect( editor.ui.view ).to.be.instanceOf( BoxedEditorUIView );
 			expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
 		} );
@@ -82,7 +82,7 @@ describe( 'ClassicTestEditor', () => {
 		it( 'creates and initializes the UI', () => {
 			return ClassicTestEditor.create( editorElement, { foo: 1 } )
 				.then( editor => {
-					expect( editor.ui ).to.be.instanceOf( ClassicTestEditorUI );
+					expect( editor.ui ).to.be.instanceOf( EditorUI );
 					expect( editor.ui.view ).to.be.instanceOf( BoxedEditorUIView );
 				} );
 		} );

+ 0 - 46
packages/ckeditor5-core/tests/_utils-tests/classictesteditorui.js

@@ -1,46 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-import ComponentFactory from '@ckeditor/ckeditor5-ui/src/componentfactory';
-import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
-import ClassicTestEditorUI from '../../tests/_utils/classictesteditorui';
-import View from '@ckeditor/ckeditor5-ui/src/view';
-
-describe( 'ClassicTestEditorUI', () => {
-	let editor, view, ui;
-
-	beforeEach( () => {
-		editor = {};
-		view = new View();
-		ui = new ClassicTestEditorUI( editor, view );
-	} );
-
-	describe( 'constructor()', () => {
-		it( 'sets #editor', () => {
-			expect( ui.editor ).to.equal( editor );
-		} );
-
-		it( 'sets #view', () => {
-			expect( ui.view ).to.equal( view );
-		} );
-
-		it( 'creates #componentFactory factory', () => {
-			expect( ui.componentFactory ).to.be.instanceOf( ComponentFactory );
-		} );
-
-		it( 'creates #focusTracker', () => {
-			expect( ui.focusTracker ).to.be.instanceOf( FocusTracker );
-		} );
-	} );
-
-	describe( 'destroy()', () => {
-		it( 'destroys the #view', () => {
-			const spy = sinon.spy( view, 'destroy' );
-
-			ui.destroy();
-			sinon.assert.calledOnce( spy );
-		} );
-	} );
-} );

+ 2 - 2
packages/ckeditor5-core/tests/_utils/classictesteditor.js

@@ -7,7 +7,7 @@ import Editor from '../../src/editor/editor';
 import ElementApiMixin from '../../src/editor/utils/elementapimixin';
 import DataApiMixin from '../../src/editor/utils/dataapimixin';
 import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
-import ClassicTestEditorUI from './classictesteditorui';
+import EditorUI from '../../src/editor/editorui';
 import BoxedEditorUIView from '@ckeditor/ckeditor5-ui/src/editorui/boxed/boxededitoruiview';
 import ElementReplacer from '@ckeditor/ckeditor5-utils/src/elementreplacer';
 import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview';
@@ -33,7 +33,7 @@ export default class ClassicTestEditor extends Editor {
 		// Use the HTML data processor in this editor.
 		this.data.processor = new HtmlDataProcessor();
 
-		this.ui = new ClassicTestEditorUI( this, new BoxedEditorUIView( this.locale ) );
+		this.ui = new EditorUI( this, new BoxedEditorUIView( this.locale ) );
 
 		// Expose properties normally exposed by the ClassicEditorUI.
 		this.ui.view.editable = new InlineEditableUIView( this.ui.view.locale );

+ 0 - 63
packages/ckeditor5-core/tests/_utils/classictesteditorui.js

@@ -1,63 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-import ComponentFactory from '@ckeditor/ckeditor5-ui/src/componentfactory';
-import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
-
-/**
- * A simplified classic editor UI class. Useful for testing features.
- *
- * @memberOf tests.core._utils
- * @extends ui.View
- */
-export default class ClassicTestEditorUI {
-	/**
-	 * Creates an instance of the test editor UI class.
-	 *
-	 * @param {core.editor.Editor} editor The editor instance.
-	 * @param {ui.editorUI.EditorUIView} view View of the ui.
-	 */
-	constructor( editor, view ) {
-		/**
-		 * Editor that the UI belongs to.
-		 *
-		 * @readonly
-		 * @member {core.editor.Editor} tests.core._utils.ClassicTestEditorUI#editor
-		 */
-		this.editor = editor;
-
-		/**
-		 * View of the ui.
-		 *
-		 * @readonly
-		 * @member {ui.editorUI.EditorUIView} tests.core._utils.ClassicTestEditorUI#view
-		 */
-		this.view = view;
-
-		/**
-		 * Instance of the {@link ui.ComponentFactory}.
-		 *
-		 * @readonly
-		 * @member {ui.ComponentFactory} tests.core._utils.ClassicTestEditorUI#componentFactory
-		 */
-		this.componentFactory = new ComponentFactory( editor );
-
-		/**
-		 * Keeps information about editor focus.
-		 *
-		 * @member {utils.FocusTracker} tests.core._utils.ClassicTestEditorUI#focusTracker
-		 */
-		this.focusTracker = new FocusTracker();
-	}
-
-	/**
-	 * Destroys the UI.
-	 *
-	 * @returns {Promise} A Promise resolved when the destruction process is finished.
-	 */
-	destroy() {
-		this.view.destroy();
-	}
-}