Преглед изворни кода

Code refactoring in Template class.

Aleksander Nowodzinski пре 9 година
родитељ
комит
62cfc903aa
2 измењених фајлова са 7 додато и 7 уклоњено
  1. 6 6
      packages/ckeditor5-ui/src/template.js
  2. 1 1
      packages/ckeditor5-ui/tests/template.js

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

@@ -274,10 +274,10 @@ export default class Template {
 			def.on[ key ].forEach( schemaItem => {
 			def.on[ key ].forEach( schemaItem => {
 				schemaItem.emitter.listenTo( el, domEvtName, ( evt, domEvt ) => {
 				schemaItem.emitter.listenTo( el, domEvtName, ( evt, domEvt ) => {
 					if ( !domSelector || domEvt.target.matches( domSelector ) ) {
 					if ( !domSelector || domEvt.target.matches( domSelector ) ) {
-						if ( typeof schemaItem.eventNameOrFuncion == 'function' ) {
-							schemaItem.eventNameOrFuncion( domEvt );
+						if ( typeof schemaItem.eventNameOrFunction == 'function' ) {
+							schemaItem.eventNameOrFunction( domEvt );
 						} else {
 						} else {
-							schemaItem.observable.fire( schemaItem.eventNameOrFuncion, domEvt );
+							schemaItem.observable.fire( schemaItem.eventNameOrFunction, domEvt );
 						}
 						}
 					}
 					}
 				} );
 				} );
@@ -376,10 +376,10 @@ Template.bind = ( observable, emitter ) => {
 		 * @param {Function} [callback] Allows processing of the value. Accepts `Node` and `value` as arguments.
 		 * @param {Function} [callback] Allows processing of the value. Accepts `Node` and `value` as arguments.
 		 * @return {ui.TemplateBinding}
 		 * @return {ui.TemplateBinding}
 		 */
 		 */
-		to: ( eventNameOrFuncionOrAttribute, callback ) => {
+		to( eventNameOrFuncionOrAttribute, callback ) {
 			return {
 			return {
 				type: bindToSymbol,
 				type: bindToSymbol,
-				eventNameOrFuncion: eventNameOrFuncionOrAttribute,
+				eventNameOrFunction: eventNameOrFuncionOrAttribute,
 				attribute: eventNameOrFuncionOrAttribute,
 				attribute: eventNameOrFuncionOrAttribute,
 				observable, emitter, callback
 				observable, emitter, callback
 			};
 			};
@@ -416,7 +416,7 @@ Template.bind = ( observable, emitter ) => {
 		 * @param {Function} [callback] Allows processing of the value. Accepts `Node` and `value` as arguments.
 		 * @param {Function} [callback] Allows processing of the value. Accepts `Node` and `value` as arguments.
 		 * @return {ui.TemplateBinding}
 		 * @return {ui.TemplateBinding}
 		 */
 		 */
-		if: ( attribute, valueIfTrue, callback ) => {
+		if( attribute, valueIfTrue, callback ) {
 			return {
 			return {
 				type: bindIfSymbol,
 				type: bindIfSymbol,
 				observable, emitter, attribute, valueIfTrue, callback
 				observable, emitter, attribute, valueIfTrue, callback

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

@@ -769,7 +769,7 @@ describe( 'Template', () => {
 					const binding = bind.to( 'foo', spy );
 					const binding = bind.to( 'foo', spy );
 
 
 					expect( spy.called ).to.be.false;
 					expect( spy.called ).to.be.false;
-					expect( binding ).to.have.keys( [ 'type', 'observable', 'eventNameOrFuncion', 'emitter', 'attribute', 'callback' ] );
+					expect( binding ).to.have.keys( [ 'type', 'observable', 'eventNameOrFunction', 'emitter', 'attribute', 'callback' ] );
 					expect( binding.observable ).to.equal( observable );
 					expect( binding.observable ).to.equal( observable );
 					expect( binding.callback ).to.equal( spy );
 					expect( binding.callback ).to.equal( spy );
 					expect( binding.attribute ).to.equal( 'foo' );
 					expect( binding.attribute ).to.equal( 'foo' );