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

Changed the default value of isEnabled to false. It's set to true on first refresh().

Piotrek Koszuliński 8 лет назад
Родитель
Сommit
f8c8965d23

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

@@ -59,7 +59,7 @@ export default class Command {
 		 * @readonly
 		 * @member {Boolean} #isEnabled
 		 */
-		this.set( 'isEnabled', true );
+		this.set( 'isEnabled', false );
 
 		this.decorate( 'execute' );
 

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

@@ -31,7 +31,7 @@ describe( 'Command', () => {
 
 		it( 'sets the state properties', () => {
 			expect( command.value ).to.be.undefined;
-			expect( command.isEnabled ).to.be.true;
+			expect( command.isEnabled ).to.be.false;
 		} );
 
 		it( 'adds a listener which refreshed the command on editor.document#changesDone', () => {
@@ -61,7 +61,7 @@ describe( 'Command', () => {
 
 			command.on( 'change:isEnabled', spy );
 
-			command.isEnabled = false;
+			command.isEnabled = true;
 
 			expect( spy.calledOnce ).to.be.true;
 		} );
@@ -73,6 +73,8 @@ describe( 'Command', () => {
 
 			command.on( 'execute', spy );
 
+			command.isEnabled = true;
+
 			command.execute( 1, 2 );
 
 			expect( spy.calledOnce ).to.be.true;
@@ -95,8 +97,6 @@ describe( 'Command', () => {
 			command.on( 'execute', spyHighest, { priority: 'highest' } );
 			command.on( 'execute', spyHigh, { priority: 'high' } );
 
-			command.isEnabled = false;
-
 			command.execute();
 
 			expect( spyExecute.called ).to.be.false;
@@ -107,8 +107,6 @@ describe( 'Command', () => {
 
 	describe( 'refresh()', () => {
 		it( 'sets isEnabled to true', () => {
-			command.isEnabled = false;
-
 			command.refresh();
 
 			expect( command.isEnabled ).to.be.true;