Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1737 from ckeditor/t/ckeditor5-undo/97
Browse files Browse the repository at this point in the history
Feature: Introduced the `type` parameter to the `model.createBatch()` method.
  • Loading branch information
Reinmar authored Jun 27, 2019
2 parents ce6422b + 8c711b1 commit 389b72e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,11 @@ export default class Model {
* * {@link #change `change()`},
* * {@link #enqueueChange `enqueueChange()`}.
*
* @param {'transparent'|'default'} [type='default'] The type of the batch.
* @returns {module:engine/model/batch~Batch}
*/
createBatch() {
return new Batch();
createBatch( type ) {
return new Batch( type );
}

/**
Expand Down
10 changes: 9 additions & 1 deletion tests/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,15 @@ describe( 'Model', () => {

describe( 'createBatch()', () => {
it( 'should return instance of Batch', () => {
expect( model.createBatch() ).to.be.instanceof( Batch );
const batch = model.createBatch();
expect( batch ).to.be.instanceof( Batch );
expect( batch.type ).to.equal( 'default' );
} );

it( 'should allow to define type of Batch', () => {
const batch = model.createBatch( 'transparent' );
expect( batch ).to.be.instanceof( Batch );
expect( batch.type ).to.equal( 'transparent' );
} );
} );

Expand Down

0 comments on commit 389b72e

Please sign in to comment.