Browse Source

Moved utils#createTestUIController helper to ckeditor5-ui.

Aleksander Nowodzinski 9 years ago
parent
commit
b4b7988073
2 changed files with 0 additions and 87 deletions
  1. 0 42
      tests/_utils-tests/utils.js
  2. 0 45
      tests/_utils/utils.js

+ 0 - 42
tests/_utils-tests/utils.js

@@ -55,45 +55,3 @@ describe( 'testUtils.defineEditorCreatorMock()', () => {
 		expect( TestCreator3.prototype ).to.have.property( 'destroy', destroyFn3 );
 	} );
 } );
-
-describe( 'testUtils.createTestUIController()', () => {
-	it( 'returns a promise', () => {
-		expect( testUtils.createTestUIController() ).to.be.instanceof( Promise );
-	} );
-
-	describe( 'controller instance', () => {
-		it( 'comes with a view', () => {
-			const promise = testUtils.createTestUIController();
-
-			return promise.then( controller => {
-				expect( controller.view.element ).to.equal( document.body );
-			} );
-		} );
-
-		it( 'creates collections and regions', () => {
-			const promise = testUtils.createTestUIController( {
-				foo: el => el.firstChild,
-				bar: el => el.lastChild,
-			} );
-
-			promise.then( controller => {
-				expect( controller.collections.get( 'foo' ) ).to.be.not.undefined;
-				expect( controller.collections.get( 'bar' ) ).to.be.not.undefined;
-
-				expect( controller.view.regions.get( 'foo' ).element ).to.equal( document.body.firstChild );
-				expect( controller.view.regions.get( 'bar' ).element ).to.equal( document.body.lastChild );
-			} );
-		} );
-
-		it( 'is ready', () => {
-			const promise = testUtils.createTestUIController( {
-				foo: el => el.firstChild,
-				bar: el => el.lastChild,
-			} );
-
-			promise.then( controller => {
-				expect( controller.ready ).to.be.true;
-			} );
-		} );
-	} );
-} );

+ 0 - 45
tests/_utils/utils.js

@@ -7,10 +7,6 @@
 
 import moduleUtils from '/tests/ckeditor5/_utils/module.js';
 
-import View from '/ckeditor5/ui/view.js';
-import Controller from '/ckeditor5/ui/controller.js';
-import ControllerCollection from '/ckeditor5/ui/controllercollection.js';
-
 /**
  * General test utils for CKEditor.
  */
@@ -64,47 +60,6 @@ const utils = {
 
 			return TestCreator;
 		} );
-	},
-
-	/**
-	 * Returns UI controller for given region/DOM selector pairs, which {@link ui.Controller#view}
-	 * is `document.body`. It is useful for manual tests which engage various UI components and/or
-	 * UI {@link ui.Controller} instances, where initialization and the process of insertion into
-	 * DOM could be problematic i.e. because of the number of instances.
-	 *
-	 * Usage:
-	 *
-	 *		// Get the controller.
-	 *		const controller = testUtils.createTestUIController();
-	 *
-	 *		// Then use it to organize and initialize children.
-	 *		controller.add( 'some-collection', childControllerInstance );
-	 *
-	 * @param {Object} regions An object literal with `regionName: DOM Selector pairs`.
-	 * See {@link ui.View#register}.
-	 */
-	createTestUIController( regions ) {
-		const TestUIView = class extends View {
-			constructor() {
-				super();
-
-				this.element = document.body;
-
-				for ( let r in regions ) {
-					this.register( r, regions[ r ] );
-				}
-			}
-		};
-
-		const controller = new Controller( null, new TestUIView() );
-
-		for ( let r in regions ) {
-			controller.collections.add( new ControllerCollection( r ) );
-		}
-
-		return controller.init().then( () => {
-			return controller;
-		} );
 	}
 };