8
0
Просмотр исходного кода

Renamed attributes->attrs in template definition.

Aleksander Nowodzinski 10 лет назад
Родитель
Сommit
24ffc31e84

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

@@ -30,7 +30,7 @@ CKEDITOR.define( function() {
 			 *         children: [
 			 *             {
 			 *                 tag: 'span',
-			 *                 attributes: { ... },
+			 *                 attrs: { ... },
 			 *                 on: { ... }
 			 *             },
 			 *             {
@@ -38,9 +38,9 @@ CKEDITOR.define( function() {
 			 *             },
 			 *             ...
 			 *         ],
-			 *         attributes: {
-			 *             'class': 'a',
-			 *             id: 'b',
+			 *         attrs: {
+			 *             'class': [ 'a', 'b' ],
+			 *             id: 'c',
 			 *             style: callback,
 			 *             ...
 			 *         },
@@ -111,8 +111,8 @@ CKEDITOR.define( function() {
 		var value;
 		var attr;
 
-		for ( attr in def.attributes ) {
-			value = def.attributes[ attr ];
+		for ( attr in def.attrs ) {
+			value = def.attrs[ attr ];
 
 			// Attribute bound directly to the model.
 			if ( typeof value == 'function' ) {

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

@@ -28,7 +28,7 @@ describe( 'render', function() {
 	it( 'creates an element', function() {
 		var el = new Template( {
 			tag: 'p',
-			attributes: {
+			attrs: {
 				'class': [ 'a', 'b' ],
 				x: 'bar'
 			},
@@ -44,7 +44,7 @@ describe( 'render', function() {
 	it( 'creates element\'s children', function() {
 		var el = new Template( {
 			tag: 'p',
-			attributes: {
+			attrs: {
 				a: 'A'
 			},
 			children: [
@@ -76,13 +76,13 @@ describe( 'callback value', function() {
 
 		var el = new Template( {
 			tag: 'p',
-			attributes: {
+			attrs: {
 				'class': spy1
 			},
 			children: [
 				{
 					tag: 'span',
-					attributes: {
+					attrs: {
 						id: spy2
 					}
 				}
@@ -162,13 +162,13 @@ describe( 'callback value', function() {
 			children: [
 				{
 					tag: 'span',
-					attributes: {
+					attrs: {
 						'id': 'x'
 					}
 				},
 				{
 					tag: 'span',
-					attributes: {
+					attrs: {
 						'class': 'y'
 					},
 					on: {

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

@@ -75,7 +75,7 @@ describe( 'bind', function() {
 		setTestViewClass( function() {
 			return {
 				tag: 'p',
-				attributes: {
+				attrs: {
 					'class': this.bind( 'foo' )
 				},
 				text: 'abc'
@@ -120,7 +120,7 @@ describe( 'bind', function() {
 		setTestViewClass( function() {
 			return {
 				tag: 'p',
-				attributes: {
+				attrs: {
 					'class': this.bind( 'foo', callback )
 				},
 				text: this.bind( 'foo', callback )
@@ -138,7 +138,7 @@ describe( 'bind', function() {
 		setTestViewClass( function() {
 			return {
 				tag: 'p',
-				attributes: {
+				attrs: {
 					'class': this.bind( 'foo', ( el, value ) => {
 						el.innerHTML = value;
 
@@ -223,7 +223,7 @@ describe( 'on', function() {
 				children: [
 					{
 						tag: 'span',
-						attributes: {
+						attrs: {
 							'class': 'y',
 						},
 						on: {
@@ -235,7 +235,7 @@ describe( 'on', function() {
 						children: [
 							{
 								tag: 'span',
-								attributes: {
+								attrs: {
 									'class': 'y',
 								}
 							}