|
|
@@ -13,6 +13,7 @@ import ModelText from '../../src/model/text';
|
|
|
import ModelTextProxy from '../../src/model/textproxy';
|
|
|
import ModelElement from '../../src/model/element';
|
|
|
import AttributeOperation from '../../src/model/operation/attributeoperation';
|
|
|
+import DetachOperation from '../../src/model/operation/detachoperation';
|
|
|
import InsertOperation from '../../src/model/operation/insertoperation';
|
|
|
import MarkerOperation from '../../src/model/operation/markeroperation';
|
|
|
import MoveOperation from '../../src/model/operation/moveoperation';
|
|
|
@@ -210,6 +211,39 @@ describe( 'debug tools', () => {
|
|
|
expect( log.calledWithExactly( op.toString() ) ).to.be.true;
|
|
|
} );
|
|
|
|
|
|
+ it( 'DetachOperation (text node)', () => {
|
|
|
+ const op = new DetachOperation( ModelPosition.createAt( modelRoot, 0 ), 3, 0 );
|
|
|
+
|
|
|
+ expect( op.toString() ).to.equal( 'DetachOperation( 0 ): #foo -> main [ 0 ] - [ 3 ]' );
|
|
|
+
|
|
|
+ op.log();
|
|
|
+ expect( log.calledWithExactly( op.toString() ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'DetachOperation (element)', () => {
|
|
|
+ const element = new ModelElement( 'element' );
|
|
|
+ modelRoot.insertChildren( 0, element );
|
|
|
+
|
|
|
+ const op = new DetachOperation( ModelPosition.createBefore( element ), 1, 0 );
|
|
|
+
|
|
|
+ expect( op.toString() ).to.equal( 'DetachOperation( 0 ): <element> -> main [ 0 ] - [ 1 ]' );
|
|
|
+
|
|
|
+ op.log();
|
|
|
+ expect( log.calledWithExactly( op.toString() ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'DetachOperation (multiple nodes)', () => {
|
|
|
+ const element = new ModelElement( 'element' );
|
|
|
+ modelRoot.insertChildren( 0, element );
|
|
|
+
|
|
|
+ const op = new DetachOperation( ModelPosition.createBefore( element ), 2, 0 );
|
|
|
+
|
|
|
+ expect( op.toString() ).to.equal( 'DetachOperation( 0 ): [ 2 ] -> main [ 0 ] - [ 2 ]' );
|
|
|
+
|
|
|
+ op.log();
|
|
|
+ expect( log.calledWithExactly( op.toString() ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
it( 'InsertOperation (text node)', () => {
|
|
|
const op = new InsertOperation( ModelPosition.createAt( modelRoot, 3 ), [ new ModelText( 'abc' ) ], 0 );
|
|
|
|