Browse Source

Merge branch 'master' into t/13

Piotrek Koszuliński 9 years ago
parent
commit
1e68b8d5a5

+ 4 - 4
packages/ckeditor5-typing/src/changebuffer.js

@@ -31,9 +31,9 @@ export default class ChangeBuffer {
 	 * Creates a new instance of the ChangeBuffer.
 	 *
 	 * @param {engine.treeModel.Document} document
-	 * @param {Number} limit Maximum number of atomic changes which can be contained in one batch.
+	 * @param {Number} [limit=20] Maximum number of atomic changes which can be contained in one batch.
 	 */
-	constructor( doc, limit ) {
+	constructor( doc, limit = 20 ) {
 		/**
 		 * Instance of the document.
 		 *
@@ -85,7 +85,7 @@ export default class ChangeBuffer {
 
 	/**
 	 * Current batch to which a feature should add its deltas. Once the {@link typing.ChangeBuffer#size}
-	 * reach or exceedes the {@link typing.ChangeBuffer#limit}, then the batch is set to a new instance and size is reset.
+	 * reach or exceeds the {@link typing.ChangeBuffer#limit}, then the batch is set to a new instance and size is reset.
 	 *
 	 * @type {engine.treeModel.batch.Batch}
 	 */
@@ -99,7 +99,7 @@ export default class ChangeBuffer {
 
 	/**
 	 * Input number of changes into the buffer. Once the {@link typing.ChangeBuffer#size}
-	 * reach or exceedes the {@link typing.ChangeBuffer#limit}, then the batch is set to a new instance and size is reset.
+	 * reach or exceeds the {@link typing.ChangeBuffer#limit}, then the batch is set to a new instance and size is reset.
 	 *
 	 * @param {Number} changeCount Number of atomic changes to input.
 	 */

+ 6 - 0
packages/ckeditor5-typing/tests/changebuffer.js

@@ -28,6 +28,12 @@ describe( 'ChangeBuffer', () => {
 			expect( buffer ).to.have.property( 'limit', CHANGE_LIMIT );
 			expect( buffer ).to.have.property( 'size', 0 );
 		} );
+
+		it( 'sets limit property according to default value', () => {
+			buffer = new ChangeBuffer( doc );
+
+			expect( buffer ).to.have.property( 'limit', 20 );
+		} );
 	} );
 
 	describe( 'batch', () => {