From 4fadd390b984e16410b63f086f774698603357eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Tue, 14 May 2019 12:10:28 +0200 Subject: [PATCH 1/2] WiP: Test using transparent batch in undo commands. --- src/model/model.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/model/model.js b/src/model/model.js index d07e336b8..61a6b73f0 100644 --- a/src/model/model.js +++ b/src/model/model.js @@ -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 ); } /** From 578a64908c7b5cdb9d6ce8d9cb072e0616f04ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Fri, 17 May 2019 12:11:01 +0200 Subject: [PATCH 2/2] Add tests for model.createBatch() type parameter. --- tests/model/model.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/model/model.js b/tests/model/model.js index 7e4178e0e..2762e8163 100644 --- a/tests/model/model.js +++ b/tests/model/model.js @@ -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' ); } ); } );