瀏覽代碼

Used Controller#addCollection() method in various classes.

Aleksander Nowodzinski 9 年之前
父節點
當前提交
cee4d847d4

+ 2 - 3
packages/ckeditor5-ui/src/editorui/boxed/boxededitorui.js

@@ -4,7 +4,6 @@
  */
 
 import EditorUI from '../../../ui/editorui/editorui.js';
-import ControllerCollection from '../../../ui/controllercollection.js';
 
 /**
  * The boxed editor UI controller class. This class controls an editor interface
@@ -27,8 +26,8 @@ export default class BoxedEditorUI extends EditorUI {
 	constructor( editor ) {
 		super( editor );
 
-		this.collections.add( new ControllerCollection( 'top' ) );
-		this.collections.add( new ControllerCollection( 'main' ) );
+		this.addCollection( 'top' );
+		this.addCollection( 'main' );
 
 		const config = editor.config;
 

+ 1 - 2
packages/ckeditor5-ui/src/editorui/editorui.js

@@ -4,7 +4,6 @@
  */
 
 import Controller from '../controller.js';
-import ControllerCollection from '../controllercollection.js';
 import ComponentFactory from '../componentfactory.js';
 import ObservableMixin from '../../utils/observablemixin.js';
 import IconManager from '../iconmanager/iconmanager.js';
@@ -46,7 +45,7 @@ export default class EditorUI extends Controller {
 		 */
 		this.featureComponents = new ComponentFactory( editor );
 
-		this.collections.add( new ControllerCollection( 'body' ) );
+		this.addCollection( 'body' );
 	}
 
 	/**

+ 1 - 2
packages/ckeditor5-ui/tests/_utils/utils.js

@@ -5,7 +5,6 @@
 
 import View from '/ckeditor5/ui/view.js';
 import Controller from '/ckeditor5/ui/controller.js';
-import ControllerCollection from '/ckeditor5/ui/controllercollection.js';
 
 /**
  * Test utils for CKEditor UI.
@@ -44,7 +43,7 @@ const utils = {
 		const controller = new Controller( null, new TestUIView() );
 
 		for ( let r in regions ) {
-			controller.collections.add( new ControllerCollection( r ) );
+			controller.addCollection( r );
 		}
 
 		return controller.init().then( () => {

+ 1 - 2
packages/ckeditor5-ui/tests/bindings/toolbarbindingsmixin.js

@@ -8,7 +8,6 @@
 import mix from '/ckeditor5/utils/mix.js';
 import Editor from '/ckeditor5/editor/editor.js';
 import Controller from '/ckeditor5/ui/controller.js';
-import ControllerCollection from '/ckeditor5/ui/controllercollection.js';
 import ToolbarBindingsMixin from '/ckeditor5/ui/bindings/toolbarbindingsmixin.js';
 
 describe( 'ToolbarBindingsMixin', () => {
@@ -21,7 +20,7 @@ describe( 'ToolbarBindingsMixin', () => {
 			constructor( model, view ) {
 				super( model, view );
 
-				this.collections.add( new ControllerCollection( 'buttons' ) );
+				this.addCollection( 'buttons' );
 			}
 		}
 

+ 1 - 1
packages/ckeditor5-ui/tests/controller.js

@@ -451,7 +451,7 @@ function defineParentControllerClass() {
 		constructor( ...args ) {
 			super( ...args );
 
-			this.collections.add( new ControllerCollection( 'x' ) );
+			this.addCollection( 'x' );
 		}
 	};
 }

+ 4 - 11
packages/ckeditor5-ui/tests/controllercollection.js

@@ -45,9 +45,7 @@ describe( 'ControllerCollection', () => {
 		it( 'should add a child controller and return promise', () => {
 			const parentController = new Controller();
 			const childController = new Controller();
-			const collection = new ControllerCollection( 'x' );
-
-			parentController.collections.add( collection );
+			const collection = parentController.addCollection( 'x' );
 
 			const returned = collection.add( childController );
 
@@ -59,9 +57,7 @@ describe( 'ControllerCollection', () => {
 			const parentController = new Controller();
 			const childController1 = new Controller();
 			const childController2 = new Controller();
-			const collection = new ControllerCollection( 'x' );
-
-			parentController.collections.add( collection );
+			const collection = parentController.addCollection( 'x' );
 
 			collection.add( childController1 );
 			collection.add( childController2, 0 );
@@ -74,9 +70,8 @@ describe( 'ControllerCollection', () => {
 			const parentController = new Controller( null, new ParentView() );
 			const childController = new Controller( null, new View() );
 			const spy = testUtils.sinon.spy( childController, 'init' );
-			const collection = new ControllerCollection( 'x' );
+			const collection = parentController.addCollection( 'x' );
 
-			parentController.collections.add( collection );
 			collection.add( childController );
 			collection.remove( childController );
 
@@ -95,9 +90,7 @@ describe( 'ControllerCollection', () => {
 			const parentController = new Controller( null, new ParentView() );
 			const childController = new Controller( null, new View() );
 			const spy = testUtils.sinon.spy( childController, 'init' );
-			const collection = new ControllerCollection( 'x' );
-
-			parentController.collections.add( collection );
+			const collection = parentController.addCollection( 'x' );
 
 			return parentController.init()
 				.then( () => {