Selaa lähdekoodia

Removed obsolete attribute set on the Undo/Redo button. Used default value for ButtonView instead.

Aleksander Nowodzinski 9 vuotta sitten
vanhempi
commit
0a91100767
2 muutettua tiedostoa jossa 10 lisäystä ja 4 poistoa
  1. 0 1
      packages/ckeditor5-undo/src/undo.js
  2. 10 3
      packages/ckeditor5-undo/tests/undo.js

+ 0 - 1
packages/ckeditor5-undo/src/undo.js

@@ -158,7 +158,6 @@ export default class Undo extends Feature {
 			const view = new ButtonView( locale );
 
 			view.set( {
-				isOn: false,
 				label: label,
 				icon: name,
 				keystroke

+ 10 - 3
packages/ckeditor5-undo/tests/undo.js

@@ -36,8 +36,8 @@ describe( 'Undo', () => {
 		expect( editor.plugins.get( UndoEngine ) ).to.be.instanceOf( UndoEngine );
 	} );
 
-	testButton( 'undo', 'CTRL+Z' );
-	testButton( 'redo', 'CTRL+Y' );
+	testButton( 'undo', 'Undo', 'CTRL+Z' );
+	testButton( 'redo', 'Redo', 'CTRL+Y' );
 
 	it( 'should set CTRL+Z keystroke', () => {
 		const spy = sinon.stub( editor, 'execute' );
@@ -66,7 +66,7 @@ describe( 'Undo', () => {
 		expect( spy.calledWithExactly( 'redo' ) ).to.be.true;
 	} );
 
-	function testButton( featureName, featureKeystroke ) {
+	function testButton( featureName, label, featureKeystroke ) {
 		describe( `${ featureName } button`, () => {
 			let button;
 
@@ -78,6 +78,13 @@ describe( 'Undo', () => {
 				expect( button ).to.be.instanceOf( ButtonView );
 			} );
 
+			it( 'should create UI component with correct attribute values', () => {
+				expect( button.isOn ).to.be.false;
+				expect( button.label ).to.equal( label );
+				expect( button.icon ).to.equal( featureName );
+				expect( button.keystroke ).to.equal( featureKeystroke );
+			} );
+
 			it( `should execute ${ featureName } command on model execute event`, () => {
 				const executeSpy = testUtils.sinon.stub( editor, 'execute' );