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

Changed: ObservableMixin now uses native EmitterMixin event namespacing.

Szymon Cofalik 9 лет назад
Родитель
Сommit
d90e0c32ad

+ 1 - 2
packages/ckeditor5-utils/src/observablemixin.js

@@ -85,8 +85,7 @@ const ObservableMixin = {
 				// Note: When attributes map has no such own property, then its value is undefined.
 				if ( oldValue !== value || !attributes.has( name ) ) {
 					attributes.set( name, value );
-					this.fire( 'change', name, value, oldValue );
-					this.fire( 'change:' + name, value, oldValue );
+					this.fire( 'change:' + name, name, value, oldValue );
 				}
 			}
 		} );

+ 3 - 3
packages/ckeditor5-utils/tests/observablemixin.js

@@ -122,9 +122,9 @@ describe( 'Observable', () => {
 			sinon.assert.calledWithExactly( spy, sinon.match.instanceOf( EventInfo ), 'color', 'blue', 'red' );
 			sinon.assert.calledWithExactly( spy, sinon.match.instanceOf( EventInfo ), 'year', 2003, 2015 );
 			sinon.assert.calledWithExactly( spy, sinon.match.instanceOf( EventInfo ), 'wheels', 4, sinon.match.typeOf( 'undefined' ) );
-			sinon.assert.calledWithExactly( spyColor, sinon.match.instanceOf( EventInfo ), 'blue', 'red' );
-			sinon.assert.calledWithExactly( spyYear, sinon.match.instanceOf( EventInfo ), 2003, 2015 );
-			sinon.assert.calledWithExactly( spyWheels, sinon.match.instanceOf( EventInfo ), 4, sinon.match.typeOf( 'undefined' ) );
+			sinon.assert.calledWithExactly( spyColor, sinon.match.instanceOf( EventInfo ), 'color', 'blue', 'red' );
+			sinon.assert.calledWithExactly( spyYear, sinon.match.instanceOf( EventInfo ), 'year', 2003, 2015 );
+			sinon.assert.calledWithExactly( spyWheels, sinon.match.instanceOf( EventInfo ), 'wheels', 4, sinon.match.typeOf( 'undefined' ) );
 		} );
 
 		it( 'should not fire the "change" event for the same attribute value', () => {