Преглед на файлове

Moved ui/toolbar/utils to ui/toolbar/getitemsfromconfig.

Aleksander Nowodzinski преди 9 години
родител
ревизия
153c872c27

+ 2 - 2
packages/ckeditor5-ui/src/toolbar/utils.js → packages/ckeditor5-ui/src/toolbar/getitemsfromconfig.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module ui/toolbar/utils
+ * @module ui/toolbar/getitemsfromconfig
  */
 
 import ToolbarSeparatorView from './toolbarseparatorview';
@@ -19,7 +19,7 @@ import ToolbarSeparatorView from './toolbarseparatorview';
  * @param {module:ui/componentfactory~ComponentFactory} factory A factory producing toolbar items.
  * @returns {Promise} A promise resolved when all toolbar items are initialized.
  */
-export function getItemsFromConfig( config, collection, factory ) {
+export default function getItemsFromConfig( config, collection, factory ) {
 	let promises = [];
 
 	if ( config ) {

+ 1 - 1
packages/ckeditor5-ui/tests/manual/contextualtoolbar/contextualtoolbar.js

@@ -13,7 +13,7 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Undo from '@ckeditor/ckeditor5-undo/src/undo';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
-import { getItemsFromConfig } from '@ckeditor/ckeditor5-ui/src/toolbar/utils';
+import getItemsFromConfig from '@ckeditor/ckeditor5-ui/src/toolbar/getitemsfromconfig';
 
 import Template from '../../../src/template';
 import ToolbarView from '../../../src/toolbar/toolbarview';

+ 1 - 1
packages/ckeditor5-ui/tests/manual/imagetoolbar/imagetoolbar.js

@@ -14,7 +14,7 @@ import Undo from '@ckeditor/ckeditor5-undo/src/undo';
 import Image from '@ckeditor/ckeditor5-image/src/image';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
-import { getItemsFromConfig } from '@ckeditor/ckeditor5-ui/src/toolbar/utils';
+import getItemsFromConfig from '@ckeditor/ckeditor5-ui/src/toolbar/getitemsfromconfig';
 
 import Template from '../../../src/template';
 import ToolbarView from '../../../src/toolbar/toolbarview';

+ 52 - 0
packages/ckeditor5-ui/tests/toolbar/getitemsfromconfig.js

@@ -0,0 +1,52 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* global document */
+
+import View from '../../src/view';
+import ComponentFactory from '../../src/componentfactory';
+import Editor from '@ckeditor/ckeditor5-core/src/editor/editor';
+import Collection from '@ckeditor/ckeditor5-utils/src/collection';
+import ToolbarSeparatorView from '../../src/toolbar/toolbarseparatorview';
+import getItemsFromConfig from '../../src/toolbar/getitemsfromconfig';
+
+describe( 'getItemsFromConfig()', () => {
+	let factory;
+
+	beforeEach( () => {
+		factory = new ComponentFactory( new Editor() );
+
+		factory.add( 'foo', viewCreator( 'foo' ) );
+		factory.add( 'bar', viewCreator( 'bar' ) );
+	} );
+
+	it( 'returns a promise', () => {
+		expect( getItemsFromConfig() ).to.be.instanceOf( Promise );
+	} );
+
+	it( 'expands the config into collection', () => {
+		const collection = new Collection();
+
+		return getItemsFromConfig( [ 'foo', 'bar', '|', 'foo' ], collection, factory )
+			.then( () => {
+				expect( collection ).to.have.length( 4 );
+				expect( collection.get( 0 ).name ).to.equal( 'foo' );
+				expect( collection.get( 1 ).name ).to.equal( 'bar' );
+				expect( collection.get( 2 ) ).to.be.instanceOf( ToolbarSeparatorView );
+				expect( collection.get( 3 ).name ).to.equal( 'foo' );
+			} );
+	} );
+} );
+
+function viewCreator( name ) {
+	return ( locale ) => {
+		const view = new View( locale );
+
+		view.name = name;
+		view.element = document.createElement( 'a' );
+
+		return view;
+	};
+}

+ 0 - 54
packages/ckeditor5-ui/tests/toolbar/utils.js

@@ -1,54 +0,0 @@
-/**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* global document */
-
-import View from '../../src/view';
-import ComponentFactory from '../../src/componentfactory';
-import Editor from '@ckeditor/ckeditor5-core/src/editor/editor';
-import Collection from '@ckeditor/ckeditor5-utils/src/collection';
-import ToolbarSeparatorView from '../../src/toolbar/toolbarseparatorview';
-import { getItemsFromConfig } from '../../src/toolbar/utils';
-
-describe( 'utils', () => {
-	describe( 'getItemsFromConfig()', () => {
-		let factory;
-
-		beforeEach( () => {
-			factory = new ComponentFactory( new Editor() );
-
-			factory.add( 'foo', viewCreator( 'foo' ) );
-			factory.add( 'bar', viewCreator( 'bar' ) );
-		} );
-
-		it( 'returns a promise', () => {
-			expect( getItemsFromConfig() ).to.be.instanceOf( Promise );
-		} );
-
-		it( 'expands the config into collection', () => {
-			const collection = new Collection();
-
-			return getItemsFromConfig( [ 'foo', 'bar', '|', 'foo' ], collection, factory )
-				.then( () => {
-					expect( collection ).to.have.length( 4 );
-					expect( collection.get( 0 ).name ).to.equal( 'foo' );
-					expect( collection.get( 1 ).name ).to.equal( 'bar' );
-					expect( collection.get( 2 ) ).to.be.instanceOf( ToolbarSeparatorView );
-					expect( collection.get( 3 ).name ).to.equal( 'foo' );
-				} );
-		} );
-	} );
-} );
-
-function viewCreator( name ) {
-	return ( locale ) => {
-		const view = new View( locale );
-
-		view.name = name;
-		view.element = document.createElement( 'a' );
-
-		return view;
-	};
-}