|
|
@@ -990,8 +990,12 @@ describe( 'DocumentSelection', () => {
|
|
|
batchTypes.set( batch, batch.type );
|
|
|
} );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
doc.batch().insert( rangeInEmptyP.start, 'x' );
|
|
|
|
|
|
+ expect( doc.enqueueChanges.calledOnce ).to.be.true;
|
|
|
+
|
|
|
expect( emptyP.hasAttribute( fooStoreAttrKey ) ).to.be.false;
|
|
|
expect( emptyP.hasAttribute( abcStoreAttrKey ) ).to.be.false;
|
|
|
|
|
|
@@ -1002,8 +1006,11 @@ describe( 'DocumentSelection', () => {
|
|
|
selection.setRanges( [ rangeInEmptyP ] );
|
|
|
selection.setAttribute( 'foo', 'bar' );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
doc.batch().move( fullP.getChild( 0 ), rangeInEmptyP.start );
|
|
|
|
|
|
+ expect( doc.enqueueChanges.calledOnce ).to.be.true;
|
|
|
expect( emptyP.hasAttribute( fooStoreAttrKey ) ).to.be.false;
|
|
|
} );
|
|
|
|
|
|
@@ -1014,9 +1021,13 @@ describe( 'DocumentSelection', () => {
|
|
|
emptyP.setAttribute( fooStoreAttrKey, 'bar' );
|
|
|
emptyP2.setAttribute( fooStoreAttrKey, 'bar' );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
// <emptyP>{}<emptyP2>
|
|
|
doc.batch().merge( Position.createAfter( emptyP ) );
|
|
|
|
|
|
+ expect( doc.enqueueChanges.calledOnce ).to.be.true;
|
|
|
+
|
|
|
expect( emptyP.hasAttribute( fooStoreAttrKey ) ).to.be.false;
|
|
|
expect( emptyP.parent ).to.equal( root ); // Just to be sure we're checking the right element.
|
|
|
} );
|
|
|
@@ -1025,6 +1036,8 @@ describe( 'DocumentSelection', () => {
|
|
|
const emptyP2 = new Element( 'p', null );
|
|
|
root.appendChildren( emptyP2 );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
emptyP.setAttribute( fooStoreAttrKey, 'bar' );
|
|
|
emptyP2.setAttribute( abcStoreAttrKey, 'bar' );
|
|
|
|
|
|
@@ -1034,6 +1047,8 @@ describe( 'DocumentSelection', () => {
|
|
|
// <emptyP>{}<emptyP2>
|
|
|
doc.batch().merge( Position.createAfter( emptyP ) );
|
|
|
|
|
|
+ expect( doc.enqueueChanges.called ).to.be.false;
|
|
|
+
|
|
|
expect( emptyP.getAttribute( fooStoreAttrKey ) ).to.equal( 'bar' );
|
|
|
expect( emptyP.parent ).to.equal( root ); // Just to be sure we're checking the right element.
|
|
|
} );
|
|
|
@@ -1043,8 +1058,11 @@ describe( 'DocumentSelection', () => {
|
|
|
|
|
|
selection.setRanges( [ rangeInFullP ] );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
doc.batch().insert( rangeInEmptyP.start, 'x' );
|
|
|
|
|
|
+ expect( doc.enqueueChanges.calledOnce ).to.be.true;
|
|
|
expect( emptyP.hasAttribute( fooStoreAttrKey ) ).to.be.false;
|
|
|
} );
|
|
|
|
|
|
@@ -1058,10 +1076,14 @@ describe( 'DocumentSelection', () => {
|
|
|
const batch = doc.batch();
|
|
|
const spy = sinon.spy( batch, 'removeAttribute' );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
// <emptyP>{}<emptyP2>
|
|
|
batch.merge( Position.createAfter( emptyP ) );
|
|
|
|
|
|
expect( emptyP.hasAttribute( fooStoreAttrKey ) ).to.be.false;
|
|
|
+
|
|
|
+ expect( doc.enqueueChanges.calledOnce ).to.be.true;
|
|
|
expect( spy.calledOnce ).to.be.true;
|
|
|
} );
|
|
|
|
|
|
@@ -1069,8 +1091,11 @@ describe( 'DocumentSelection', () => {
|
|
|
selection.setRanges( [ rangeInEmptyP ] );
|
|
|
selection.setAttribute( 'foo', 'bar' );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
doc.batch( 'transparent' ).insert( rangeInEmptyP.start, 'x' );
|
|
|
|
|
|
+ expect( doc.enqueueChanges.called ).to.be.false;
|
|
|
expect( emptyP.getAttribute( fooStoreAttrKey ) ).to.equal( 'bar' );
|
|
|
} );
|
|
|
|
|
|
@@ -1080,8 +1105,11 @@ describe( 'DocumentSelection', () => {
|
|
|
selection.setRanges( [ rangeInEmptyP ] );
|
|
|
selection.setAttribute( 'foo', 'bar' );
|
|
|
|
|
|
+ sinon.spy( doc, 'enqueueChanges' );
|
|
|
+
|
|
|
doc.batch().rename( emptyP, 'pnew' );
|
|
|
|
|
|
+ expect( doc.enqueueChanges.called ).to.be.false;
|
|
|
expect( emptyP.getAttribute( fooStoreAttrKey ) ).to.equal( 'bar' );
|
|
|
} );
|
|
|
} );
|