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

Increased test code coverage for Model#bind.

Aleksander Nowodzinski пре 10 година
родитељ
комит
23969743ca
1 измењених фајлова са 2 додато и 4 уклоњено
  1. 2 4
      packages/ckeditor5-engine/src/model.js

+ 2 - 4
packages/ckeditor5-engine/src/model.js

@@ -428,7 +428,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], ( EmitterMixin, C
 	 * @param {*} value The value of the attribute.
 	 */
 	function updateModelAttr( model, attrName, value ) {
-		if ( model.attrName ) {
+		if ( model[ attrName ] ) {
 			model[ attrName ] = value;
 		} else {
 			model.set( attrName, value );
@@ -462,9 +462,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], ( EmitterMixin, C
 			//
 			// MODEL.bind( 'a' ).to( TOMODEL1 )[ .to( TOMODELn ) ].as( callback )
 			//  \-> Use model attribute name to collect boundTo attribute value (TOMODELn.a).
-			const values = chain._boundTo.map( boundTo => {
-				return boundTo.model[ boundTo.attrs.length ? boundTo.attrs[ 0 ] : chain.attrs[ 0 ] ];
-			} );
+			const values = chain._boundTo.map( boundTo => boundTo.model[ boundTo.attrs[ 0 ] ] );
 
 			// Pass collected attribute values to the callback function.
 			// Whatever is returned it becomes the value of the model's attribute.