ソースを参照

Renamed attr->attributes and def->definition in Template class interface.

Aleksander Nowodzinski 10 年 前
コミット
01235da506

+ 9 - 9
packages/ckeditor5-ui/src/ui/template.js

@@ -19,7 +19,7 @@ export default class Template {
 	/**
 	 * Creates an instance of the {@link Template} class.
 	 *
-	 * @param {TemplateDefinition} def The definition of the template.
+	 * @param {TemplateDefinition} definition The definition of the template.
 	 * @constructor
 	 */
 	constructor( def ) {
@@ -28,16 +28,16 @@ export default class Template {
 		 *
 		 * @property {TemplateDefinition}
 		 */
-		this.def = def;
+		this.definition = def;
 	}
 
 	/**
-	 * Renders DOM Node using {@link #def}.
+	 * Renders DOM Node using {@link #definition}.
 	 *
 	 * @returns {HTMLElement}
 	 */
 	render() {
-		return this._renderNode( this.def, true );
+		return this._renderNode( this.definition, true );
 	}
 
 	/**
@@ -146,8 +146,8 @@ export default class Template {
 	_renderElementAttributes( def, el ) {
 		let attr, value;
 
-		for ( attr in def.attrs ) {
-			value = def.attrs[ attr ];
+		for ( attr in def.attributes ) {
+			value = def.attributes[ attr ];
 
 			// Attribute bound directly to the model.
 			if ( typeof value == 'function' ) {
@@ -245,7 +245,7 @@ function getAttributeUpdater( attr ) {
  *			children: [
  *				{
  *					tag: 'span',
- *					attrs: { ... },
+ *					attributes: { ... },
  *					children: [ ... ],
  *					...
  *				},
@@ -255,7 +255,7 @@ function getAttributeUpdater( attr ) {
  *				'def',
  *				...
  *			],
- *			attrs: {
+ *			attributes: {
  *				'class': [ 'a', 'b' ],
  *				id: 'c',
  *				style: callback,
@@ -274,7 +274,7 @@ function getAttributeUpdater( attr ) {
  * @type Object
  * @property {String} tag
  * @property {Array} [children]
- * @property {Object} [attrs]
+ * @property {Object} [attributes]
  * @property {String} [text]
  * @property {Object} [on]
  */

+ 7 - 7
packages/ckeditor5-ui/tests/ui/template.js

@@ -21,7 +21,7 @@ describe( 'Template', () => {
 				tag: 'p'
 			};
 
-			expect( new Template( def ).def ).to.equal( def );
+			expect( new Template( def ).definition ).to.equal( def );
 		} );
 	} );
 
@@ -46,7 +46,7 @@ describe( 'Template', () => {
 		it( 'creates a HTMLElement', () => {
 			let el = new Template( {
 				tag: 'p',
-				attrs: {
+				attributes: {
 					'class': [ 'a', 'b' ],
 					x: 'bar'
 				},
@@ -61,7 +61,7 @@ describe( 'Template', () => {
 		it( 'creates HTMLElement\'s children', () => {
 			let el = new Template( {
 				tag: 'p',
-				attrs: {
+				attributes: {
 					a: 'A'
 				},
 				children: [
@@ -121,13 +121,13 @@ describe( 'Template', () => {
 
 				let el = new Template( {
 					tag: 'p',
-					attrs: {
+					attributes: {
 						'class': spy1
 					},
 					children: [
 						{
 							tag: 'span',
-							attrs: {
+							attributes: {
 								id: spy2
 							}
 						}
@@ -213,13 +213,13 @@ describe( 'Template', () => {
 					children: [
 						{
 							tag: 'span',
-							attrs: {
+							attributes: {
 								'id': 'x'
 							}
 						},
 						{
 							tag: 'span',
-							attrs: {
+							attributes: {
 								'class': 'y'
 							},
 							on: {

+ 5 - 5
packages/ckeditor5-ui/tests/ui/view.js

@@ -243,7 +243,7 @@ describe( 'View', () => {
 			setTestViewClass( function() {
 				return {
 					tag: 'p',
-					attrs: {
+					attributes: {
 						'class': this.bindToAttribute( 'foo' )
 					},
 					children: [ 'abc' ]
@@ -289,7 +289,7 @@ describe( 'View', () => {
 			setTestViewClass( function() {
 				return {
 					tag: 'p',
-					attrs: {
+					attributes: {
 						'class': this.bindToAttribute( 'foo', callback )
 					},
 					children: [
@@ -309,7 +309,7 @@ describe( 'View', () => {
 			setTestViewClass( function() {
 				return {
 					tag: 'p',
-					attrs: {
+					attributes: {
 						'class': this.bindToAttribute( 'foo', ( el, value ) => {
 							el.innerHTML = value;
 
@@ -396,7 +396,7 @@ describe( 'View', () => {
 					children: [
 						{
 							tag: 'span',
-							attrs: {
+							attributes: {
 								'class': 'y',
 							},
 							on: {
@@ -408,7 +408,7 @@ describe( 'View', () => {
 							children: [
 								{
 									tag: 'span',
-									attrs: {
+									attributes: {
 										'class': 'y',
 									}
 								}