Explorar o código

Internal: Changed `beforeChange` event to `set`.

Oskar Wróbel %!s(int64=7) %!d(string=hai) anos
pai
achega
3e4e666212

+ 2 - 2
packages/ckeditor5-core/src/command.js

@@ -79,10 +79,10 @@ export default class Command {
 		// By default commands are disabled when the editor is in read-only mode.
 		this.listenTo( editor, 'change:isReadOnly', ( evt, name, value ) => {
 			if ( value ) {
-				this.on( 'beforeChange:isEnabled', forceDisable, { priority: 'highest' } );
+				this.on( 'set:isEnabled', forceDisable, { priority: 'highest' } );
 				this.isEnabled = false;
 			} else {
-				this.off( 'beforeChange:isEnabled', forceDisable );
+				this.off( 'set:isEnabled', forceDisable );
 				this.refresh();
 			}
 		} );

+ 4 - 4
packages/ckeditor5-core/tests/command.js

@@ -99,19 +99,19 @@ describe( 'Command', () => {
 			expect( editor.something ).to.false;
 		} );
 
-		it( 'stops beforeChange event to force disabled and not affect change event', () => {
-			const beforeChangeSpy = sinon.spy();
+		it( 'stops `set` event to force disabled and not affect `change` event', () => {
+			const setSpy = sinon.spy();
 			const changeSpy = sinon.spy();
 
 			command.isEnabled = true;
 			editor.isReadOnly = false;
 
-			command.on( 'beforeChange', beforeChangeSpy );
+			command.on( 'set', setSpy );
 			command.on( 'change', changeSpy );
 
 			editor.isReadOnly = true;
 
-			sinon.assert.notCalled( beforeChangeSpy );
+			sinon.assert.notCalled( setSpy );
 			sinon.assert.calledOnce( changeSpy );
 		} );
 	} );