From 0fd5b264b078cdca458f0c76e4c1f036749e8509 Mon Sep 17 00:00:00 2001 From: Maciej Bukowski Date: Wed, 24 Oct 2018 17:02:36 +0200 Subject: [PATCH 1/2] Made markers created by `Writer#insert()` affect data. --- src/model/writer.js | 2 +- tests/model/writer.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/model/writer.js b/src/model/writer.js index d763ce376..9ba588455 100644 --- a/src/model/writer.js +++ b/src/model/writer.js @@ -204,7 +204,7 @@ export default class Writer { markerRange.end._getCombined( rangeRootPosition, position ) ); - this.addMarker( markerName, { range, usingOperation: true } ); + this.addMarker( markerName, { range, usingOperation: true, affectsData: true } ); } } } diff --git a/tests/model/writer.js b/tests/model/writer.js index fd466b90e..622c30a92 100644 --- a/tests/model/writer.js +++ b/tests/model/writer.js @@ -314,6 +314,8 @@ describe( 'Writer', () => { expect( range.root ).to.equal( root ); expect( range.start.path ).to.deep.equal( [ 2, 1 ] ); expect( range.end.path ).to.deep.equal( [ 2, 5 ] ); + expect( range.usingOperation ).to.equal( true ); + expect( range.affectsData ).to.equal( true ); } ); it( 'should throw when trying to use detached writer', () => { From c478a3ed7943241d173e7ec84b9d49fcce633fda Mon Sep 17 00:00:00 2001 From: Maciej Bukowski Date: Wed, 24 Oct 2018 17:55:00 +0200 Subject: [PATCH 2/2] Fixed tests. --- tests/model/writer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/model/writer.js b/tests/model/writer.js index 622c30a92..109d78788 100644 --- a/tests/model/writer.js +++ b/tests/model/writer.js @@ -310,12 +310,13 @@ describe( 'Writer', () => { expect( Array.from( model.markers ).length ).to.equal( 1 ); - const range = model.markers.get( 'marker' ).getRange(); + const modelMarker = model.markers.get( 'marker' ); + const range = modelMarker.getRange(); expect( range.root ).to.equal( root ); expect( range.start.path ).to.deep.equal( [ 2, 1 ] ); expect( range.end.path ).to.deep.equal( [ 2, 5 ] ); - expect( range.usingOperation ).to.equal( true ); - expect( range.affectsData ).to.equal( true ); + expect( modelMarker.managedUsingOperations ).to.be.true; + expect( modelMarker.affectsData ).to.be.true; } ); it( 'should throw when trying to use detached writer', () => {