Parcourir la source

Renamed ColorGrid, ColorTile -> ColorGridView, ColorTileView.

Aleksander Nowodzinski il y a 6 ans
Parent
commit
639dc134dd

+ 11 - 11
packages/ckeditor5-ui/src/colorgrid/colorgrid.js

@@ -8,25 +8,25 @@
  */
 
 import View from '../view';
-import ColorTile from './colortile';
+import ColorTileView from './colortileview';
 import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
 import FocusCycler from '../focuscycler';
 import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
 import '../../theme/components/colorgrid/colorgrid.css';
 
 /**
- * A grid of {@link module:ui/colorgrid/colortile~ColorTile color tiles}.
+ * A grid of {@link module:ui/colorgrid/colortile~ColorTileView color tiles}.
  *
  * @extends module:ui/view~View
  */
-export default class ColorGrid extends View {
+export default class ColorGridView extends View {
 	/**
-	 * Creates an instance of a color grid containing {@link module:ui/colorgrid/colortile~ColorTile tiles}.
+	 * Creates an instance of a color grid containing {@link module:ui/colorgrid/colortile~ColorTileView tiles}.
 	 *
 	 * @param {module:utils/locale~Locale} [locale] The localization services instance.
 	 * @param {Object} options Component configuration
 	 * @param {Array.<module:ui/colorgrid/colorgrid~ColorDefinition>} [options.colorDefinitions] Array with definitions
-	 * required to create the {@link module:ui/colorgrid/colortile~ColorTile tiles}.
+	 * required to create the {@link module:ui/colorgrid/colortile~ColorTileView tiles}.
 	 * @param {Number} options.columns A number of columns to display the tiles.
 	 */
 	constructor( locale, options ) {
@@ -84,7 +84,7 @@ export default class ColorGrid extends View {
 		} );
 
 		colorDefinitions.forEach( item => {
-			const colorTile = new ColorTile();
+			const colorTile = new ColorTileView();
 
 			colorTile.set( {
 				color: item.color,
@@ -160,7 +160,7 @@ export default class ColorGrid extends View {
 }
 
 /**
- * A color definition used to create a {@link module:ui/colorgrid/colortile~ColorTile}.
+ * A color definition used to create a {@link module:ui/colorgrid/colortile~ColorTileView}.
  *
  *		{
  *			color: hsl(0, 0%, 75%),
@@ -174,9 +174,9 @@ export default class ColorGrid extends View {
  * @type Object
  *
  * @property {String} color String representing a color.
- * It is used as value of background-color style in {@link module:ui/colorgrid/colortile~ColorTile}.
- * @property {String} label String used as label for {@link module:ui/colorgrid/colortile~ColorTile}.
- * @property {Object} options Additional options passed to create a {@link module:ui/colorgrid/colortile~ColorTile}.
+ * It is used as value of background-color style in {@link module:ui/colorgrid/colortile~ColorTileView}.
+ * @property {String} label String used as label for {@link module:ui/colorgrid/colortile~ColorTileView}.
+ * @property {Object} options Additional options passed to create a {@link module:ui/colorgrid/colortile~ColorTileView}.
  * @property {Boolean} options.hasBorder A flag that indicates if special a CSS class should be added
- * to {@link module:ui/colorgrid/colortile~ColorTile}, which renders a border around it.
+ * to {@link module:ui/colorgrid/colortile~ColorTileView}, which renders a border around it.
  */

+ 2 - 2
packages/ckeditor5-ui/src/colorgrid/colortile.js

@@ -10,11 +10,11 @@
 import ButtonView from '../button/buttonview';
 
 /**
- * This class represents a single color tile in the {@link module:ui/colorgrid/colorgrid~ColorGrid}.
+ * This class represents a single color tile in the {@link module:ui/colorgrid/colorgrid~ColorGridView}.
  *
  * @extends module:ui/button/buttonview~ButtonView
  */
-export default class ColorTile extends ButtonView {
+export default class ColorTileView extends ButtonView {
 	constructor( locale ) {
 		super( locale );
 

+ 8 - 8
packages/ckeditor5-ui/tests/colorgrid/colorgrid.js

@@ -5,15 +5,15 @@
 
 /* globals Event */
 
-import ColorGrid from './../../src/colorgrid/colorgrid';
-import ColorTile from '../../src/colorgrid/colortile';
+import ColorGridView from './../../src/colorgrid/colorgridview';
+import ColorTileView from '../../src/colorgrid/colortileview';
 import ViewCollection from '../../src/viewcollection';
 import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
 import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
 import FocusCycler from '../../src/focuscycler';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-describe( 'ColorGrid', () => {
+describe( 'ColorGridView', () => {
 	let locale, view;
 
 	const colorDefinitions = [
@@ -42,7 +42,7 @@ describe( 'ColorGrid', () => {
 
 	beforeEach( () => {
 		locale = { t() {} };
-		view = new ColorGrid( locale, { colorDefinitions } );
+		view = new ColorGridView( locale, { colorDefinitions } );
 		view.render();
 	} );
 
@@ -59,7 +59,7 @@ describe( 'ColorGrid', () => {
 		} );
 
 		it( 'uses the options#columns to control the grid', () => {
-			const view = new ColorGrid( locale, { columns: 3 } );
+			const view = new ColorGridView( locale, { columns: 3 } );
 			view.render();
 
 			expect( view.element.style.gridTemplateColumns ).to.equal( '1fr 1fr 1fr' );
@@ -68,7 +68,7 @@ describe( 'ColorGrid', () => {
 		} );
 
 		it( 'creates the view without provided color definitions', () => {
-			const view = new ColorGrid( locale );
+			const view = new ColorGridView( locale );
 			view.render();
 
 			expect( view.items ).to.have.length( 0 );
@@ -102,7 +102,7 @@ describe( 'ColorGrid', () => {
 					it( `for (index: ${ index }, color: ${ color.color }) child`, () => {
 						const colorTile = view.items.get( index );
 
-						expect( colorTile ).to.be.instanceOf( ColorTile );
+						expect( colorTile ).to.be.instanceOf( ColorTileView );
 						expect( colorTile.color ).to.equal( color.color );
 					} );
 				} );
@@ -162,7 +162,7 @@ describe( 'ColorGrid', () => {
 			it( 'adding new element', () => {
 				const spy = sinon.spy( view.focusTracker, 'add' );
 
-				const colorTile = new ColorTile();
+				const colorTile = new ColorTileView();
 				colorTile.set( {
 					color: 'yellow',
 					label: 'Yellow',

+ 4 - 4
packages/ckeditor5-ui/tests/colorgrid/colortile.js

@@ -3,16 +3,16 @@
  * For licensing, see LICENSE.md.
  */
 
-import ColorTile from '../../src/colorgrid/colortile';
+import ColorTileView from '../../src/colorgrid/colortileview';
 import ButtonView from '../../src/button/buttonview';
 
-describe( 'ColorTile', () => {
+describe( 'ColorTileView', () => {
 	it( 'inherits from ButtonView', () => {
-		expect( new ColorTile() ).to.be.instanceOf( ButtonView );
+		expect( new ColorTileView() ).to.be.instanceOf( ButtonView );
 	} );
 
 	it( 'has proper attributes and classes', () => {
-		const colorTile = new ColorTile();
+		const colorTile = new ColorTileView();
 		colorTile.render();
 
 		expect( colorTile.color ).to.be.undefined;