Przeglądaj źródła

Added test for undo step configuration.

Piotrek Koszuliński 9 lat temu
rodzic
commit
acb8da8091

+ 1 - 1
packages/ckeditor5-typing/src/typing.js

@@ -35,7 +35,7 @@ export default class Typing extends Feature {
 		 * @protected
 		 * @member {typing.ChangeBuffer} typing.Typing#_buffer
 		 */
-		this._buffer = new ChangeBuffer( editor.document, editor.config.get( 'typing.undoLimit' ) || 20 );
+		this._buffer = new ChangeBuffer( editor.document, editor.config.get( 'typing.undoStep' ) || 20 );
 
 		// TODO The above default config value should be defines using editor.config.define() once it's fixed.
 

+ 16 - 0
packages/ckeditor5-typing/tests/typing.js

@@ -51,6 +51,22 @@ describe( 'Typing feature', () => {
 		listenter.stopListening();
 	} );
 
+	it( 'has a buffer configured to default value of config.typing.undoStep', () => {
+		expect( editor.plugins.get( Typing )._buffer ).to.have.property( 'limit', 20 );
+	} );
+
+	it( 'has a buffer configured to config.typing.undoStep', () => {
+		return VirtualTestEditor.create( {
+				features: [ Typing ],
+				typing: {
+					undoStep: 5
+				}
+			} )
+			.then( editor => {
+				expect( editor.plugins.get( Typing )._buffer ).to.have.property( 'limit', 5 );
+			} );
+	} );
+
 	describe( 'mutations handling', () => {
 		it( 'should handle text mutation', () => {
 			view.fire( 'mutations', [