Browse Source

Changed: Added logging whether `MoveOperation` is sticky for `MoveOperation.log()`.

Szymon Cofalik 8 years ago
parent
commit
02f40d876f

+ 1 - 1
packages/ckeditor5-engine/src/dev-utils/enableenginedebug.js

@@ -287,7 +287,7 @@ function enableLoggingTools() {
 		const range = ModelRange.createFromPositionAndShift( this.sourcePosition, this.howMany );
 
 		return getClassName( this ) + `( ${ this.baseVersion } ): ` +
-			`${ range } -> ${ this.targetPosition }`;
+			`${ range } -> ${ this.targetPosition }${ this.isSticky ? ' (sticky)' : '' }`;
 	};
 
 	NoOperation.prototype.toString = function() {

+ 10 - 0
packages/ckeditor5-engine/tests/dev-utils/enableenginedebug.js

@@ -236,6 +236,16 @@ describe( 'debug tools', () => {
 				expect( log.calledWithExactly( op.toString() ) ).to.be.true;
 			} );
 
+			it( 'MoveOperation sticky', () => {
+				const op = new MoveOperation( ModelPosition.createAt( modelRoot, 1 ), 2, ModelPosition.createAt( modelRoot, 6 ), 0 );
+				op.isSticky = true;
+
+				expect( op.toString() ).to.equal( 'MoveOperation( 0 ): main [ 1 ] - [ 3 ] -> main [ 6 ] (sticky)' );
+
+				op.log();
+				expect( log.calledWithExactly( op.toString() ) ).to.be.true;
+			} );
+
 			it( 'NoOperation', () => {
 				const op = new NoOperation( 0 );