Browse Source

Removed: Removed WrapOperation and UnwrapOperation and associated code.

Szymon Cofalik 7 years ago
parent
commit
6e8e191dc6

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

@@ -25,8 +25,6 @@ import MoveOperation from '../model/operation/moveoperation';
 import NoOperation from '../model/operation/nooperation';
 import RenameOperation from '../model/operation/renameoperation';
 import RootAttributeOperation from '../model/operation/rootattributeoperation';
-import WrapOperation from '../model/operation/wrapoperation';
-import UnwrapOperation from '../model/operation/unwrapoperation';
 import SplitOperation from '../model/operation/splitoperation';
 import MergeOperation from '../model/operation/mergeoperation';
 import Model from '../model/model';
@@ -361,17 +359,6 @@ function enableLoggingTools() {
 			`( ${ this.howMany } ) -> ${ this.insertionPosition }${ this.graveyardPosition ? ' with ' + this.graveyardPosition : '' }`;
 	} );
 
-	sandbox.mock( WrapOperation.prototype, 'toString', function() {
-		const range = ModelRange.createFromPositionAndShift( this.position, this.howMany );
-
-		return getClassName( this ) + `( ${ this.baseVersion } ): ` +
-			`${ range } with ${ this.element ? this.element : this.graveyardPosition }`;
-	} );
-
-	sandbox.mock( UnwrapOperation.prototype, 'toString', function() {
-		return getClassName( this ) + `( ${ this.baseVersion } ): ${ this.position } ( ${ this.howMany } ), ${ this.graveyardPosition }`;
-	} );
-
 	sandbox.mock( ViewText.prototype, 'toString', function() {
 		return `#${ this.data }`;
 	} );

+ 0 - 32
packages/ckeditor5-engine/src/model/differ.js

@@ -222,38 +222,6 @@ export default class Differ {
 
 				break;
 			}
-			case 'wrap': {
-				// Mark that some elements were removed from their original parent and that a new (wrapper) element
-				// was added in that parent.
-				if ( !this._isInInsertedElement( operation.position.parent ) ) {
-					this._markRemove( operation.position.parent, operation.position.offset, operation.howMany );
-					this._markInsert( operation.position.parent, operation.position.offset, 1 );
-				}
-
-				// If the wrap took the element from the graveyard, mark that the element from the graveyard was removed.
-				if ( operation.graveyardPosition ) {
-					this._markRemove( operation.graveyardPosition.parent, operation.graveyardPosition.offset, 1 );
-				}
-
-				break;
-			}
-			case 'unwrap': {
-				// Mark that the unwrapped element was removed from its original parent and that new (unwrapped) nodes
-				// were inserted in that parent.
-				const elementToUnwrap = operation.position.parent;
-				const offset = elementToUnwrap.startOffset;
-				const parent = elementToUnwrap.parent;
-
-				if ( !this._isInInsertedElement( parent ) ) {
-					this._markRemove( parent, offset, 1 );
-					this._markInsert( parent, offset, elementToUnwrap.maxOffset );
-				}
-
-				// Mark that the unwrapped element was moved to the graveyard.
-				this._markInsert( operation.graveyardPosition.parent, operation.graveyardPosition.offset, 1 );
-
-				break;
-			}
 		}
 
 		// Clear cache after each buffered operation as it is no longer valid.

+ 0 - 2
packages/ckeditor5-engine/src/model/liverange.js

@@ -170,8 +170,6 @@ function transform( operation ) {
 function doesOperationChangeRangeContent( range, operation ) {
 	switch ( operation.type ) {
 		case 'insert':
-		case 'wrap':
-		case 'unwrap':
 			return range.containsPosition( operation.position );
 		case 'move':
 		case 'remove':

+ 0 - 4
packages/ckeditor5-engine/src/model/operation/operationfactory.js

@@ -17,8 +17,6 @@ import RenameOperation from '../operation/renameoperation';
 import RootAttributeOperation from '../operation/rootattributeoperation';
 import SplitOperation from '../operation/splitoperation';
 import MergeOperation from '../operation/mergeoperation';
-import WrapOperation from '../operation/wrapoperation';
-import UnwrapOperation from '../operation/unwrapoperation';
 
 const operations = {};
 operations[ AttributeOperation.className ] = AttributeOperation;
@@ -31,8 +29,6 @@ operations[ RenameOperation.className ] = RenameOperation;
 operations[ RootAttributeOperation.className ] = RootAttributeOperation;
 operations[ SplitOperation.className ] = SplitOperation;
 operations[ MergeOperation.className ] = MergeOperation;
-operations[ WrapOperation.className ] = WrapOperation;
-operations[ UnwrapOperation.className ] = UnwrapOperation;
 
 /**
  * A factory class for creating operations.

+ 0 - 177
packages/ckeditor5-engine/src/model/operation/unwrapoperation.js

@@ -1,177 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/**
- * @module engine/model/operation/unwrapoperation
- */
-
-import Operation from './operation';
-import WrapOperation from './wrapoperation';
-import Position from '../position';
-import Range from '../range';
-import { _move } from './utils';
-
-import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
-
-/**
- * Operation to unwrap a {@link module:engine/model/element~Element model element}. In the result, the unwrapped element
- * is removed and its children are moved in its place.
- *
- * @extends module:engine/model/operation/operation~Operation
- */
-export default class UnwrapOperation extends Operation {
-	/**
-	 * Creates an unwrap operation.
-	 *
-	 * @param {module:engine/model/position~Position} position Position inside the element to unwrap.
-	 * @param {Number} howMany Total offset size of nodes that are inside unwrapped element.
-	 * @param {module:engine/model/position~Position} graveyardPosition Position in the graveyard root to which
-	 * the unwrapped element will be moved.
-	 * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
-	 * can be applied or `null` if the operation operates on detached (non-document) tree.
-	 */
-	constructor( position, howMany, graveyardPosition, baseVersion ) {
-		super( baseVersion );
-
-		/**
-		 * Position inside the element to unwrap.
-		 *
-		 * It should be a position at the beginning of that element.
-		 *
-		 * @member {module:engine/model/position~Position} module:engine/model/operation/unwrapoperation~UnwrapOperation#position
-		 */
-		this.position = Position.createFromPosition( position );
-		this.position.stickiness = 'toPrevious'; // Keep the position always at the beginning of the element.
-
-		/**
-		 * Position in the graveyard root to which the unwrapped element will be moved.
-		 *
-		 * @member {module:engine/model/position~Position} module:engine/model/operation/unwrapoperation~UnwrapOperation#graveyardPosition
-		 */
-		this.graveyardPosition = Position.createFromPosition( graveyardPosition );
-
-		/**
-		 * Total offset size of nodes that are inside unwrapped element.
-		 *
-		 * @member {Number} module:engine/model/operation/unwrapoperation~UnwrapOperation#howMany
-		 */
-		this.howMany = howMany;
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	get type() {
-		return 'unwrap';
-	}
-
-	/**
-	 * A range containing all nodes that will be unwrapped.
-	 *
-	 * @readonly
-	 * @type {module:engine/model/range~Range}
-	 */
-	get unwrappedRange() {
-		return Range.createFromPositionAndShift( this.position, this.howMany );
-	}
-
-	/**
-	 * A position where the unwrapped nodes will be moved. At the same time, it is the position before the unwrapped element.
-	 *
-	 * @readonly
-	 * @type {module:engine/model/position~Position}
-	 */
-	get targetPosition() {
-		const path = this.position.path.slice( 0, -1 );
-
-		return new Position( this.position.root, path );
-	}
-
-	/**
-	 * Creates and returns an operation that has the same parameters as this operation.
-	 *
-	 * @returns {module:engine/model/operation/unwrapoperation~UnwrapOperation} Clone of this operation.
-	 */
-	clone() {
-		return new this.constructor( this.position, this.howMany, this.graveyardPosition, this.baseVersion );
-	}
-
-	/**
-	 * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
-	 *
-	 * @returns {module:engine/model/operation/wrapoperation~WrapOperation}
-	 */
-	getReversed() {
-		return new WrapOperation( this.targetPosition, this.howMany, this.graveyardPosition, this.baseVersion + 1 );
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	_validate() {
-		const element = this.position.parent;
-
-		// Validate whether unwrap operation has correct parameters.
-		if ( !element || !element.is( 'element' ) ) {
-			/**
-			 * Unwrap position is invalid.
-			 *
-			 * @error unwrap-operation-position-invalid
-			 */
-			throw new CKEditorError( 'unwrap-operation-position-invalid: Unwrap position is invalid.' );
-		} else if ( element.maxOffset !== this.howMany ) {
-			/**
-			 * Operation specifies incorrect number of nodes to unwrap.
-			 *
-			 * @error unwrap-operation-how-many-invalid
-			 */
-			throw new CKEditorError( 'unwrap-operation-how-many-invalid: Operation specifies incorrect number of nodes to unwrap.' );
-		}
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	_execute() {
-		const elementToUnwrap = this.position.parent;
-		const targetPosition = Position.createAfter( elementToUnwrap );
-
-		_move( this.unwrappedRange, targetPosition );
-		_move( Range.createOn( elementToUnwrap ), this.graveyardPosition );
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	toJSON() {
-		const json = super.toJSON();
-
-		json.position = this.position.toJSON();
-		json.graveyardPosition = this.graveyardPosition.toJSON();
-
-		return json;
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	static get className() {
-		return 'UnwrapOperation';
-	}
-
-	/**
-	 * Creates `UnwrapOperation` object from deserilized object, i.e. from parsed JSON string.
-	 *
-	 * @param {Object} json Deserialized JSON object.
-	 * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
-	 * @returns {module:engine/model/operation/unwrapoperation~UnwrapOperation}
-	 */
-	static fromJSON( json, document ) {
-		const position = Position.fromJSON( json.position, document );
-		const graveyardPosition = Position.fromJSON( json.graveyardPosition, document );
-
-		return new this( position, json.howMany, graveyardPosition, json.baseVersion );
-	}
-}

+ 0 - 228
packages/ckeditor5-engine/src/model/operation/wrapoperation.js

@@ -1,228 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/**
- * @module engine/model/operation/wrapoperation
- */
-
-import Operation from './operation';
-import UnwrapOperation from './unwrapoperation';
-import Position from '../position';
-import Range from '../range';
-import Element from '../element';
-import { _insert, _move } from './utils';
-
-import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
-
-/**
- * Operation to wrap a range of {@link module:engine/model/node~Node nodes} with an {@link module:engine/model/element~Element element}.
- *
- * @extends module:engine/model/operation/operation~Operation
- */
-export default class WrapOperation extends Operation {
-	/**
-	 * Creates a wrap operation.
-	 *
-	 * @param {module:engine/model/position~Position} position Position before
-	 * the first {@link module:engine/model/item~Item model item} to wrap.
-	 * @param {Number} howMany Offset size of wrapped range. Wrapped range will start at `position.offset` and end at
-	 * `position.offset + howMany`.
-	 * @param {module:engine/model/element~Element|module:engine/model/position~Position} elementOrPosition Wrapper
-	 * element or position in graveyard before the element which should be used as a wrapper.
-	 * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
-	 * can be applied or `null` if the operation operates on detached (non-document) tree.
-	 */
-	constructor( position, howMany, elementOrPosition, baseVersion ) {
-		super( baseVersion );
-
-		/**
-		 * Position before the first {@link module:engine/model/node~Node node} to wrap.
-		 *
-		 * @member {module:engine/model/position~Position} module:engine/model/operation/wrapoperation~WrapOperation#position
-		 */
-		this.position = Position.createFromPosition( position );
-		// `'toNext'` because `position` is a bit like a start of the wrapped range.
-		this.position.stickiness = 'toNext';
-
-		/**
-		 * Total offset size of the wrapped range.
-		 *
-		 * Wrapped range will start at `position.offset` and end at `position.offset + howMany`.
-		 *
-		 * @member {Number} module:engine/model/operation/wrapoperation~WrapOperation#howMany
-		 */
-		this.howMany = howMany;
-
-		/**
-		 * Wrapper element that will be used to wrap nodes.
-		 *
-		 * Is `null` if `elementOrPosition` was a {@link module:engine/model/position~Position}.
-		 *
-		 * @member {module:engine/model/element~Element} module:engine/model/operation/wrapoperation~WrapOperation#element
-		 */
-		this.element = elementOrPosition instanceof Element ? elementOrPosition : null;
-
-		/**
-		 * Position in the graveyard root before the element that will be used as a wrapper element.
-		 *
-		 * Is `null` if `elementOrPosition` was a {@link module:engine/model/element~Element}.
-		 *
-		 * @member {module:engine/model/element~Element} module:engine/model/operation/wrapoperation~WrapOperation#graveyardPosition
-		 */
-		this.graveyardPosition = elementOrPosition instanceof Element ? null : Position.createFromPosition( elementOrPosition );
-
-		if ( this.graveyardPosition ) {
-			this.graveyardPosition.stickiness = 'toNext';
-		}
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	get type() {
-		return 'wrap';
-	}
-
-	/**
-	 * Position to which the wrapped elements will be moved. This is a position at the beginning of the wrapping element.
-	 *
-	 * @readonly
-	 * @type {module:engine/model/position~Position}
-	 */
-	get targetPosition() {
-		const path = this.position.path.slice();
-		path.push( 0 );
-
-		return new Position( this.position.root, path );
-	}
-
-	/**
-	 * A range containing all nodes that will be wrapped.
-	 *
-	 * @readonly
-	 * @type {module:engine/model/range~Range}
-	 */
-	get wrappedRange() {
-		return Range.createFromPositionAndShift( this.position, this.howMany );
-	}
-
-	/**
-	 * Creates and returns an operation that has the same parameters as this operation.
-	 *
-	 * @returns {module:engine/model/operation/wrapoperation~WrapOperation} Clone of this operation.
-	 */
-	clone() {
-		const elementOrPosition = this.element ? this.element._clone() : this.graveyardPosition;
-
-		return new this.constructor( this.position, this.howMany, elementOrPosition, this.baseVersion );
-	}
-
-	/**
-	 * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
-	 *
-	 * @returns {module:engine/model/operation/unwrapoperation~UnwrapOperation}
-	 */
-	getReversed() {
-		const graveyard = this.position.root.document.graveyard;
-		const graveyardPosition = new Position( graveyard, [ 0 ] );
-
-		return new UnwrapOperation( this.targetPosition, this.howMany, graveyardPosition, this.baseVersion + 1 );
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	_validate() {
-		const element = this.position.parent;
-
-		// Validate whether wrap operation has correct parameters.
-		if ( !element || this.position.offset > element.maxOffset ) {
-			/**
-			 * Wrap position is invalid.
-			 *
-			 * @error wrap-operation-position-invalid
-			 */
-			throw new CKEditorError( 'wrap-operation-position-invalid: Wrap position is invalid.' );
-		} else if ( this.position.offset + this.howMany > element.maxOffset ) {
-			/**
-			 * Invalid number of nodes to wrap.
-			 *
-			 * @error wrap-operation-how-many-invalid
-			 */
-			throw new CKEditorError( 'wrap-operation-how-many-invalid: Invalid number of nodes to wrap.' );
-		} else if ( this.graveyardPosition && !this.graveyardPosition.nodeAfter ) {
-			/**
-			 * Graveyard position invalid.
-			 *
-			 * @error wrap-operation-graveyard-position-invalid
-			 */
-			throw new CKEditorError( 'wrap-operation-graveyard-position-invalid: Graveyard position invalid.' );
-		}
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	_execute() {
-		const wrappedRange = this.wrappedRange;
-
-		const insertPosition = Position.createFromPosition( wrappedRange.end );
-
-		const targetPath = insertPosition.path.slice();
-		targetPath.push( 0 );
-		const targetPosition = new Position( this.position.root, targetPath );
-
-		if ( this.element ) {
-			const originalElement = this.element;
-			this.element = this.element._clone();
-
-			_insert( insertPosition, originalElement );
-		} else {
-			_move( Range.createFromPositionAndShift( this.graveyardPosition, 1 ), insertPosition );
-		}
-
-		_move( wrappedRange, targetPosition );
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	toJSON() {
-		const json = super.toJSON();
-
-		json.position = this.position.toJSON();
-
-		if ( this.element ) {
-			json.element = this.element.toJSON();
-			delete json.graveyardPosition;
-		} else {
-			json.graveyardPosition = this.graveyardPosition.toJSON();
-			delete json.element;
-		}
-
-		return json;
-	}
-
-	/**
-	 * @inheritDoc
-	 */
-	static get className() {
-		return 'WrapOperation';
-	}
-
-	/**
-	 * Creates `WrapOperation` object from deserilized object, i.e. from parsed JSON string.
-	 *
-	 * @param {Object} json Deserialized JSON object.
-	 * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
-	 * @returns {module:engine/model/operation/wrapoperation~WrapOperation}
-	 */
-	static fromJSON( json, document ) {
-		const position = Position.fromJSON( json.position, document );
-		const elementOrPosition = json.element ? Element.fromJSON( json.element ) : Position.fromJSON( json.graveyardPosition, document );
-
-		return new this( position, json.howMany, elementOrPosition, json.baseVersion );
-	}
-}

+ 0 - 69
packages/ckeditor5-engine/src/model/position.js

@@ -537,12 +537,6 @@ export default class Position {
 			case 'merge':
 				result = this._getTransformedByMergeOperation( operation );
 				break;
-			case 'wrap':
-				result = this._getTransformedByWrapOperation( operation );
-				break;
-			case 'unwrap':
-				result = this._getTransformedByUnwrapOperation( operation );
-				break;
 			default:
 				result = Position.createFromPosition( this );
 				break;
@@ -627,69 +621,6 @@ export default class Position {
 	}
 
 	/**
-	 * Returns a copy of this position transformed by wrap operation.
-	 *
-	 * @protected
-	 * @param {module:engine/model/operation/wrapoperation~WrapOperation} operation
-	 * @returns {module:engine/model/position~Position}
-	 */
-	_getTransformedByWrapOperation( operation ) {
-		const wrappedRange = operation.wrappedRange;
-
-		const isContained = wrappedRange.containsPosition( this ) ||
-			( wrappedRange.start.isEqual( this ) && this.stickiness == 'toNext' ) ||
-			( wrappedRange.end.isEqual( this ) && this.stickiness == 'toPrevious' );
-
-		if ( isContained ) {
-			return this._getCombined( wrappedRange.start, operation.targetPosition );
-		} else if ( this.isEqual( operation.position ) ) {
-			return Position.createFromPosition( this );
-		} else {
-			if ( operation.graveyardPosition ) {
-				const pos = this._getTransformedByMove( operation.graveyardPosition, operation.position, 1 );
-
-				return pos._getTransformedByMove( operation.position.getShiftedBy( 1 ), operation.targetPosition, operation.howMany );
-			} else {
-				return this._getTransformedByDeletion( operation.position, operation.howMany - 1 );
-			}
-		}
-	}
-
-	/**
-	 * Returns a copy of this position transformed by unwrap operation.
-	 *
-	 * @protected
-	 * @param {module:engine/model/operation/unwrapoperation~UnwrapOperation} operation
-	 * @returns {module:engine/model/position~Position}
-	 */
-	_getTransformedByUnwrapOperation( operation ) {
-		const unwrappedRange = operation.unwrappedRange;
-
-		const isContained = unwrappedRange.containsPosition( this ) ||
-			unwrappedRange.start.isEqual( this ) ||
-			unwrappedRange.end.isEqual( this );
-
-		let pos;
-
-		if ( isContained ) {
-			pos = this._getCombined( operation.position, operation.targetPosition );
-		} else if ( this.isEqual( operation.targetPosition ) ) {
-			pos = Position.createFromPosition( this );
-		} else {
-			pos = this._getTransformedByInsertion( operation.targetPosition, operation.howMany );
-		}
-
-		const targetPosition = operation.targetPosition.getShiftedBy( operation.howMany );
-
-		if ( !targetPosition.isEqual( operation.graveyardPosition ) ) {
-			pos = pos._getTransformedByDeletion( targetPosition, 1 );
-			pos = pos._getTransformedByInsertion( operation.graveyardPosition, 1 );
-		}
-
-		return pos;
-	}
-
-	/**
 	 * Returns a copy of this position that is updated by removing `howMany` nodes starting from `deletePosition`.
 	 * It may happen that this position is in a removed node. If that is the case, `null` is returned instead.
 	 *

+ 0 - 36
packages/ckeditor5-engine/src/model/range.js

@@ -411,10 +411,6 @@ export default class Range {
 				return [ this._getTransformedBySplitOperation( operation ) ];
 			case 'merge':
 				return [ this._getTransformedByMergeOperation( operation ) ];
-			case 'wrap':
-				return [ this._getTransformedByWrapOperation( operation ) ];
-			case 'unwrap':
-				return [ this._getTransformedByUnwrapOperation( operation ) ];
 		}
 
 		return [ Range.createFromRange( this ) ];
@@ -594,38 +590,6 @@ export default class Range {
 	}
 
 	/**
-	 * Returns a result of transforming a copy of this range by wrap operation.
-	 *
-	 * Always one range is returned. The transformation is done in a way to not break the range.
-	 *
-	 * @protected
-	 * @param {module:engine/model/operation/wrapoperation~WrapOperation} operation
-	 * @returns {module:engine/model/range~Range}
-	 */
-	_getTransformedByWrapOperation( operation ) {
-		const start = this.start._getTransformedByWrapOperation( operation );
-		const end = this.end._getTransformedByWrapOperation( operation );
-
-		return new Range( start, end );
-	}
-
-	/**
-	 * Returns a result of transforming a copy of this range by unwrap operation.
-	 *
-	 * Always one range is returned. The transformation is done in a way to not break the range.
-	 *
-	 * @protected
-	 * @param {module:engine/model/operation/unwrapoperation~UnwrapOperation} operation
-	 * @returns {module:engine/model/range~Range}
-	 */
-	_getTransformedByUnwrapOperation( operation ) {
-		const start = this.start._getTransformedByUnwrapOperation( operation );
-		const end = this.end._getTransformedByUnwrapOperation( operation );
-
-		return new Range( start, end );
-	}
-
-	/**
 	 * Returns an array containing one or two {@link ~Range ranges} that are a result of transforming this
 	 * {@link ~Range range} by inserting `howMany` nodes at `insertPosition`. Two {@link ~Range ranges} are
 	 * returned if the insertion was inside this {@link ~Range range} and `spread` is set to `true`.

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

@@ -23,8 +23,6 @@ import RenameOperation from '../../src/model/operation/renameoperation';
 import RootAttributeOperation from '../../src/model/operation/rootattributeoperation';
 import MergeOperation from '../../src/model/operation/mergeoperation';
 import SplitOperation from '../../src/model/operation/splitoperation';
-import WrapOperation from '../../src/model/operation/wrapoperation';
-import UnwrapOperation from '../../src/model/operation/unwrapoperation';
 import Model from '../../src/model/model';
 import ModelDocumentFragment from '../../src/model/documentfragment';
 
@@ -382,54 +380,6 @@ describe( 'debug tools', () => {
 				op.log();
 				expect( log.calledWithExactly( op.toString() ) ).to.be.true;
 			} );
-
-			it( 'WrapOperation with element', () => {
-				const op = new WrapOperation(
-					new ModelPosition( modelRoot, [ 3 ] ),
-					2,
-					new ModelElement( 'blockQuote' ),
-					0
-				);
-
-				expect( op.toString() ).to.equal(
-					'WrapOperation( 0 ): main [ 3 ] - [ 5 ] with <blockQuote>'
-				);
-
-				op.log();
-				expect( log.calledWithExactly( op.toString() ) ).to.be.true;
-			} );
-
-			it( 'WrapOperation with graveyard position', () => {
-				const op = new WrapOperation(
-					new ModelPosition( modelRoot, [ 3 ] ),
-					2,
-					new ModelPosition( modelDoc.graveyard, [ 0 ] ),
-					0
-				);
-
-				expect( op.toString() ).to.equal(
-					'WrapOperation( 0 ): main [ 3 ] - [ 5 ] with $graveyard [ 0 ]'
-				);
-
-				op.log();
-				expect( log.calledWithExactly( op.toString() ) ).to.be.true;
-			} );
-
-			it( 'UnwrapOperation', () => {
-				const op = new UnwrapOperation(
-					new ModelPosition( modelRoot, [ 1, 0 ] ),
-					2,
-					new ModelPosition( modelDoc.graveyard, [ 0 ] ),
-					0
-				);
-
-				expect( op.toString() ).to.equal(
-					'UnwrapOperation( 0 ): main [ 1, 0 ] ( 2 ), $graveyard [ 0 ]'
-				);
-
-				op.log();
-				expect( log.calledWithExactly( op.toString() ) ).to.be.true;
-			} );
 		} );
 
 		it( 'for applied operations', () => {

+ 0 - 141
packages/ckeditor5-engine/tests/model/differ.js

@@ -15,8 +15,6 @@ import RenameOperation from '../../src/model/operation/renameoperation';
 import AttributeOperation from '../../src/model/operation/attributeoperation';
 import SplitOperation from '../../src/model/operation/splitoperation';
 import MergeOperation from '../../src/model/operation/mergeoperation';
-import WrapOperation from '../../src/model/operation/wrapoperation';
-import UnwrapOperation from '../../src/model/operation/unwrapoperation';
 
 describe( 'Differ', () => {
 	let doc, differ, root, model;
@@ -1389,132 +1387,6 @@ describe( 'Differ', () => {
 		} );
 	} );
 
-	describe( 'wrap', () => {
-		it( 'wrap elements', () => {
-			model.change( () => {
-				wrap( new Position( root, [ 0 ] ), 2, new Element( 'blockQuote' ) );
-
-				expectChanges( [
-					{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
-					{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
-					{ type: 'insert', name: 'blockQuote', length: 1, position: new Position( root, [ 0 ] ) }
-				] );
-			} );
-		} );
-
-		it( 'wrap old and new elements', () => {
-			model.change( () => {
-				insert( new Element( 'paragraph' ), new Position( root, [ 0 ] ) );
-				wrap( new Position( root, [ 0 ] ), 2, new Element( 'blockQuote' ) );
-
-				expectChanges( [
-					{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
-					{ type: 'insert', name: 'blockQuote', length: 1, position: new Position( root, [ 0 ] ) }
-				] );
-			} );
-		} );
-
-		it( 'wrap inside a new element', () => {
-			model.change( () => {
-				insert(
-					new Element( 'div', null, [
-						new Element( 'paragraph' ),
-						new Element( 'paragraph' )
-					] ),
-					new Position( root, [ 0 ] )
-				);
-				wrap( new Position( root, [ 0, 0 ] ), 2, new Element( 'blockQuote' ) );
-
-				expectChanges( [
-					{ type: 'insert', name: 'div', length: 1, position: new Position( root, [ 0 ] ) }
-				] );
-			} );
-		} );
-
-		it( 'should correctly mark a change in graveyard', () => {
-			model.change( () => {
-				unwrap( new Position( root, [ 0, 0 ] ) );
-			} );
-
-			model.change( () => {
-				const operation = new WrapOperation( new Position( root, [ 0 ] ), 3, new Position( doc.graveyard, [ 0 ] ), doc.version );
-
-				model.applyOperation( operation );
-
-				expectChanges( [
-					{ type: 'remove', name: 'paragraph', length: 1, position: new Position( doc.graveyard, [ 0 ] ) },
-					{ type: 'remove', name: '$text', length: 3, position: new Position( root, [ 0 ] ) },
-					{ type: 'insert', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) }
-				], true );
-			} );
-		} );
-	} );
-
-	describe( 'unwrap', () => {
-		it( 'unwrap elements', () => {
-			model.change( () => {
-				unwrap( new Position( root, [ 0, 0 ] ) );
-
-				expectChanges( [
-					{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
-					{ type: 'insert', name: '$text', length: 3, position: new Position( root, [ 0 ] ) }
-				] );
-			} );
-		} );
-
-		it( 'unwrap a new element', () => {
-			model.change( () => {
-				insert( new Element( 'paragraph', null, new Text( 'Ab' ) ), new Position( root, [ 0 ] ) );
-				unwrap( new Position( root, [ 0, 0 ] ) );
-
-				expectChanges( [
-					{ type: 'insert', name: '$text', length: 2, position: new Position( root, [ 0 ] ) }
-				] );
-			} );
-		} );
-
-		it( 'unwrap element with new nodes', () => {
-			model.change( () => {
-				insert( new Text( 'Ab' ), new Position( root, [ 0, 1 ] ) );
-				unwrap( new Position( root, [ 0, 0 ] ) );
-
-				expectChanges( [
-					{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
-					{ type: 'insert', name: '$text', length: 5, position: new Position( root, [ 0 ] ) }
-				] );
-			} );
-		} );
-
-		it( 'unwrap element inside a new element', () => {
-			model.change( () => {
-				insert(
-					new Element( 'blockQuote', null, [
-						new Element( 'paragraph', null, new Text( 'Ab' ) )
-					] ),
-					new Position( root, [ 0 ] )
-				);
-
-				unwrap( new Position( root, [ 0, 0, 0 ] ) );
-
-				expectChanges( [
-					{ type: 'insert', name: 'blockQuote', length: 1, position: new Position( root, [ 0 ] ) }
-				] );
-			} );
-		} );
-
-		it( 'should correctly mark a change in graveyard', () => {
-			model.change( () => {
-				unwrap( new Position( root, [ 0, 0 ] ) );
-
-				expectChanges( [
-					{ type: 'insert', name: 'paragraph', length: 1, position: new Position( doc.graveyard, [ 0 ] ) },
-					{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
-					{ type: 'insert', name: '$text', length: 3, position: new Position( root, [ 0 ] ) }
-				], true );
-			} );
-		} );
-	} );
-
 	describe( 'markers', () => {
 		let range, rangeB;
 
@@ -1889,19 +1761,6 @@ describe( 'Differ', () => {
 		model.applyOperation( operation );
 	}
 
-	function wrap( position, howMany, element ) {
-		const operation = new WrapOperation( position, howMany, element, doc.version );
-
-		model.applyOperation( operation );
-	}
-
-	function unwrap( position ) {
-		const howMany = position.parent.maxOffset;
-		const operation = new UnwrapOperation( position, howMany, new Position( doc.graveyard, [ 0 ] ), doc.version );
-
-		model.applyOperation( operation );
-	}
-
 	function remove( sourcePosition, howMany ) {
 		const targetPosition = Position.createAt( doc.graveyard, doc.graveyard.maxOffset );
 		const operation = new MoveOperation( sourcePosition, howMany, targetPosition, doc.version );

+ 0 - 173
packages/ckeditor5-engine/tests/model/operation/unwrapoperation.js

@@ -1,173 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-import Model from '../../../src/model/model';
-import UnwrapOperation from '../../../src/model/operation/unwrapoperation';
-import WrapOperation from '../../../src/model/operation/wrapoperation';
-import Position from '../../../src/model/position';
-import Element from '../../../src/model/element';
-import Text from '../../../src/model/text';
-import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
-
-describe( 'UnwrapOperation', () => {
-	let model, doc, root, gy, gyPos;
-
-	beforeEach( () => {
-		model = new Model();
-		doc = model.document;
-		root = doc.createRoot();
-		gy = doc.graveyard;
-		gyPos = new Position( gy, [ 0 ] );
-	} );
-
-	it( 'should have proper type', () => {
-		const unwrap = new UnwrapOperation( new Position( root, [ 1, 0 ] ), 2, gyPos, 1 );
-
-		expect( unwrap.type ).to.equal( 'unwrap' );
-	} );
-
-	it( 'should have proper targetPosition', () => {
-		const unwrap = new UnwrapOperation( new Position( root, [ 1, 0 ] ), 2, gyPos, 1 );
-
-		expect( unwrap.targetPosition.path ).to.deep.equal( [ 1 ] );
-	} );
-
-	it( 'should have proper unwrappedRange', () => {
-		const unwrap = new UnwrapOperation( new Position( root, [ 1, 0 ] ), 2, gyPos, 1 );
-
-		expect( unwrap.unwrappedRange.start.path ).to.deep.equal( [ 1, 0 ] );
-		expect( unwrap.unwrappedRange.end.path ).to.deep.equal( [ 1, 2 ] );
-	} );
-
-	it( 'should unwrap an element', () => {
-		const bq = new Element( 'blockQuote', null, [
-			new Element( 'paragraph', null, new Text( 'Foo' ) ),
-			new Element( 'listItem', null, new Text( 'bar' ) )
-		] );
-
-		root._insertChild( 0, [ bq ] );
-
-		const operation = new UnwrapOperation( new Position( root, [ 0, 0 ] ), 2, gyPos, doc.version );
-
-		model.applyOperation( operation );
-
-		expect( doc.version ).to.equal( 1 );
-		expect( root.maxOffset ).to.equal( 2 );
-		expect( root.getChild( 0 ).name ).to.equal( 'paragraph' );
-		expect( root.getChild( 1 ).name ).to.equal( 'listItem' );
-	} );
-
-	it( 'should create a proper WrapOperation as a reverse', () => {
-		const operation = new UnwrapOperation( new Position( root, [ 1, 0 ] ), 2, gyPos, doc.version );
-		const reverse = operation.getReversed();
-
-		expect( reverse ).to.be.an.instanceof( WrapOperation );
-		expect( reverse.baseVersion ).to.equal( 1 );
-		expect( reverse.position.isEqual( new Position( root, [ 1 ] ) ) ).to.be.true;
-		expect( reverse.howMany ).to.equal( 2 );
-		expect( reverse.element ).to.be.null;
-		expect( reverse.graveyardPosition.isEqual( gyPos ) ).to.be.true;
-	} );
-
-	it( 'should undo unwrap by applying reverse operation', () => {
-		const bq = new Element( 'blockQuote', null, [
-			new Element( 'paragraph', null, new Text( 'Foo' ) ),
-			new Element( 'listItem', null, new Text( 'bar' ) )
-		] );
-
-		root._insertChild( 0, [ bq ] );
-
-		const operation = new UnwrapOperation( new Position( root, [ 0, 0 ] ), 2, gyPos, doc.version );
-
-		model.applyOperation( operation );
-		model.applyOperation( operation.getReversed() );
-
-		expect( doc.version ).to.equal( 2 );
-		expect( root.maxOffset ).to.equal( 1 );
-		expect( root.getChild( 0 ).name ).to.equal( 'blockQuote' );
-		expect( root.getChild( 0 ).maxOffset ).to.equal( 2 );
-	} );
-
-	describe( '_validate()', () => {
-		it( 'should throw an error if position is invalid', () => {
-			const p1 = new Element( 'p1', null, new Text( 'Foo' ) );
-
-			root._insertChild( 0, [ p1 ] );
-
-			const operation = new UnwrapOperation(
-				new Position( root, [ 1, 0 ] ),
-				3,
-				gyPos,
-				doc.version
-			);
-
-			expect( () => operation._validate() ).to.throw( CKEditorError, /unwrap-operation-position-invalid/ );
-		} );
-
-		it( 'should throw an error if number of nodes to unwrap is invalid', () => {
-			const p1 = new Element( 'p1', null, new Text( 'Foo' ) );
-
-			root._insertChild( 0, [ p1 ] );
-
-			const operation = new UnwrapOperation(
-				new Position( root, [ 0, 0 ] ),
-				5,
-				gyPos,
-				doc.version
-			);
-
-			expect( () => operation._validate() ).to.throw( CKEditorError, /unwrap-operation-how-many-invalid/ );
-		} );
-	} );
-
-	it( 'should create UnwrapOperation with the same parameters when cloned', () => {
-		const position = new Position( root, [ 1, 0 ] );
-		const howMany = 4;
-		const baseVersion = doc.version;
-
-		const op = new UnwrapOperation( position, howMany, gyPos, baseVersion );
-
-		const clone = op.clone();
-
-		// New instance rather than a pointer to the old instance.
-		expect( clone ).not.to.be.equal( op );
-
-		expect( clone ).to.be.instanceof( UnwrapOperation );
-		expect( clone.position.isEqual( position ) ).to.be.true;
-		expect( clone.howMany ).to.equal( howMany );
-		expect( clone.graveyardPosition.isEqual( gyPos ) ).to.be.true;
-		expect( clone.baseVersion ).to.equal( baseVersion );
-	} );
-
-	describe( 'toJSON', () => {
-		it( 'should create proper json object', () => {
-			const position = new Position( root, [ 1, 0 ] );
-			const op = new UnwrapOperation( position, 4, gyPos, doc.version );
-
-			const serialized = op.toJSON();
-
-			expect( serialized ).to.deep.equal( {
-				__className: 'UnwrapOperation',
-				baseVersion: 0,
-				howMany: 4,
-				position: op.position.toJSON(),
-				graveyardPosition: gyPos.toJSON()
-			} );
-		} );
-	} );
-
-	describe( 'fromJSON', () => {
-		it( 'should create proper UnwrapOperation from json object', () => {
-			const position = new Position( root, [ 1, 0 ] );
-			const op = new UnwrapOperation( position, 4, gyPos, doc.version );
-
-			const serialized = op.toJSON();
-
-			const deserialized = UnwrapOperation.fromJSON( serialized, doc );
-
-			expect( deserialized ).to.deep.equal( op );
-		} );
-	} );
-} );

+ 0 - 265
packages/ckeditor5-engine/tests/model/operation/wrapoperation.js

@@ -1,265 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-import Model from '../../../src/model/model';
-import Element from '../../../src/model/element';
-import Text from '../../../src/model/text';
-import WrapOperation from '../../../src/model/operation/wrapoperation';
-import UnwrapOperation from '../../../src/model/operation/unwrapoperation';
-import Position from '../../../src/model/position';
-import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
-
-describe( 'WrapOperation', () => {
-	let model, doc, root, gy, gyPos;
-
-	beforeEach( () => {
-		model = new Model();
-		doc = model.document;
-		root = doc.createRoot();
-		gy = doc.graveyard;
-		gyPos = new Position( gy, [ 0 ] );
-	} );
-
-	it( 'should have proper type', () => {
-		const wrap = new WrapOperation( new Position( root, [ 1 ] ), 2, new Element( 'paragraph' ), 1 );
-
-		expect( wrap.type ).to.equal( 'wrap' );
-	} );
-
-	it( 'should have proper targetPosition', () => {
-		const wrap = new WrapOperation( new Position( root, [ 1 ] ), 2, new Element( 'paragraph' ), 1 );
-
-		expect( wrap.targetPosition.path ).to.deep.equal( [ 1, 0 ] );
-	} );
-
-	it( 'should have proper wrappedRange', () => {
-		const wrap = new WrapOperation( new Position( root, [ 1 ] ), 2, new Element( 'paragraph' ), 1 );
-
-		expect( wrap.wrappedRange.start.path ).to.deep.equal( [ 1 ] );
-		expect( wrap.wrappedRange.end.path ).to.deep.equal( [ 3 ] );
-	} );
-
-	it( 'should wrap nodes into an element', () => {
-		root._insertChild( 0, [
-			new Element( 'paragraph', null, new Text( 'Foo' ) ),
-			new Element( 'listItem', null, new Text( 'bar' ) )
-		] );
-
-		const operation = new WrapOperation( new Position( root, [ 0 ] ), 2, new Element( 'blockQuote' ), doc.version );
-
-		model.applyOperation( operation );
-
-		expect( doc.version ).to.equal( 1 );
-		expect( root.maxOffset ).to.equal( 1 );
-		expect( root.getChild( 0 ).name ).to.equal( 'blockQuote' );
-		expect( root.getChild( 0 ).maxOffset ).to.equal( 2 );
-		expect( root.getChild( 0 ).getChild( 0 ).name ).to.equal( 'paragraph' );
-		expect( root.getChild( 0 ).getChild( 1 ).name ).to.equal( 'listItem' );
-	} );
-
-	it( 'should wrap nodes into an element from graveyard', () => {
-		root._insertChild( 0, [
-			new Element( 'paragraph', null, new Text( 'Foo' ) ),
-			new Element( 'listItem', null, new Text( 'bar' ) )
-		] );
-
-		gy._insertChild( 0, [ new Element( 'blockQuote' ) ] );
-
-		const operation = new WrapOperation( new Position( root, [ 0 ] ), 2, gyPos, doc.version );
-
-		model.applyOperation( operation );
-
-		expect( doc.version ).to.equal( 1 );
-		expect( root.maxOffset ).to.equal( 1 );
-		expect( root.getChild( 0 ).name ).to.equal( 'blockQuote' );
-		expect( root.getChild( 0 ).maxOffset ).to.equal( 2 );
-		expect( root.getChild( 0 ).getChild( 0 ).name ).to.equal( 'paragraph' );
-		expect( root.getChild( 0 ).getChild( 1 ).name ).to.equal( 'listItem' );
-		expect( gy.maxOffset ).to.equal( 0 );
-	} );
-
-	it( 'should create a proper UnwrapOperation as a reverse', () => {
-		const operation = new WrapOperation( new Position( root, [ 1 ] ), 2, new Element( 'blockQuote' ), doc.version );
-		const reverse = operation.getReversed();
-
-		expect( reverse ).to.be.an.instanceof( UnwrapOperation );
-		expect( reverse.baseVersion ).to.equal( 1 );
-		expect( reverse.position.isEqual( new Position( root, [ 1, 0 ] ) ) ).to.be.true;
-		expect( reverse.howMany ).to.equal( 2 );
-		expect( reverse.graveyardPosition.isEqual( gyPos ) ).to.be.true;
-	} );
-
-	it( 'should undo wrap by applying reverse operation', () => {
-		root._insertChild( 0, [
-			new Element( 'paragraph', null, new Text( 'Foo' ) ),
-			new Element( 'listItem', null, new Text( 'bar' ) )
-		] );
-
-		const operation = new WrapOperation( new Position( root, [ 0 ] ), 2, new Element( 'blockQuote' ), doc.version );
-
-		model.applyOperation( operation );
-		model.applyOperation( operation.getReversed() );
-
-		expect( doc.version ).to.equal( 2 );
-		expect( root.maxOffset ).to.equal( 2 );
-		expect( root.getChild( 0 ).name ).to.equal( 'paragraph' );
-		expect( root.getChild( 1 ).name ).to.equal( 'listItem' );
-	} );
-
-	describe( '_validate()', () => {
-		it( 'should throw an error if position is invalid', () => {
-			const p1 = new Element( 'p1', null, new Text( 'Foo' ) );
-
-			root._insertChild( 0, [ p1 ] );
-
-			const operation = new WrapOperation(
-				new Position( root, [ 4 ] ),
-				3,
-				new Element( 'blockQuote' ),
-				doc.version
-			);
-
-			expect( () => operation._validate() ).to.throw( CKEditorError, /wrap-operation-position-invalid/ );
-		} );
-
-		it( 'should throw an error if number of nodes to wrap is invalid', () => {
-			const p1 = new Element( 'p1', null, new Text( 'Foo' ) );
-
-			root._insertChild( 0, [ p1 ] );
-
-			const operation = new WrapOperation(
-				new Position( root, [ 0 ] ),
-				5,
-				new Element( 'blockQuote' ),
-				doc.version
-			);
-
-			expect( () => operation._validate() ).to.throw( CKEditorError, /wrap-operation-how-many-invalid/ );
-		} );
-
-		it( 'should throw an error if graveyard position is invalid', () => {
-			const p1 = new Element( 'p1', null, new Text( 'Foo' ) );
-
-			root._insertChild( 0, [ p1 ] );
-
-			const operation = new WrapOperation(
-				new Position( root, [ 0 ] ),
-				1,
-				gyPos,
-				doc.version
-			);
-
-			expect( () => operation._validate() ).to.throw( CKEditorError, /wrap-operation-graveyard-position-invalid/ );
-		} );
-	} );
-
-	it( 'should create WrapOperation with the same parameters when cloned #1', () => {
-		const position = new Position( root, [ 1, 0 ] );
-		const howMany = 4;
-		const baseVersion = doc.version;
-		const element = new Element( 'blockQuote' );
-
-		const op = new WrapOperation( position, howMany, element, baseVersion );
-
-		const clone = op.clone();
-
-		// New instance rather than a pointer to the old instance.
-		expect( clone ).not.to.be.equal( op );
-
-		expect( clone ).to.be.instanceof( WrapOperation );
-		expect( clone.position.isEqual( position ) ).to.be.true;
-		expect( clone.element ).not.to.equal( element );
-		expect( clone.element ).to.deep.equal( element );
-		expect( clone.graveyardPosition ).to.be.null;
-		expect( clone.howMany ).to.equal( howMany );
-		expect( clone.baseVersion ).to.equal( baseVersion );
-	} );
-
-	it( 'should create WrapOperation with the same parameters when cloned #2', () => {
-		const position = new Position( root, [ 1, 0 ] );
-		const howMany = 4;
-		const baseVersion = doc.version;
-
-		const op = new WrapOperation( position, howMany, gyPos, baseVersion );
-
-		const clone = op.clone();
-
-		expect( clone.position.isEqual( position ) ).to.be.true;
-		expect( clone.graveyardPosition.isEqual( gyPos ) ).to.be.true;
-		expect( clone.element ).to.be.null;
-		expect( clone.howMany ).to.equal( howMany );
-		expect( clone.baseVersion ).to.equal( baseVersion );
-	} );
-
-	describe( 'toJSON', () => {
-		it( 'should create proper serialized object #1', () => {
-			const op = new WrapOperation(
-				new Position( root, [ 0 ] ),
-				1,
-				new Position( doc.graveyard, [ 0 ] ),
-				doc.version
-			);
-
-			const serialized = op.toJSON();
-
-			expect( serialized ).to.deep.equal( {
-				__className: 'WrapOperation',
-				baseVersion: 0,
-				position: op.position.toJSON(),
-				graveyardPosition: op.graveyardPosition.toJSON(),
-				howMany: 1
-			} );
-		} );
-
-		it( 'should create proper serialized object #2', () => {
-			const op = new WrapOperation(
-				new Position( root, [ 0 ] ),
-				1,
-				new Element( 'paragraph' ),
-				doc.version
-			);
-
-			const serialized = op.toJSON();
-
-			expect( serialized ).to.deep.equal( {
-				__className: 'WrapOperation',
-				baseVersion: 0,
-				position: op.position.toJSON(),
-				element: op.element.toJSON(),
-				howMany: 1
-			} );
-		} );
-	} );
-
-	describe( 'fromJSON', () => {
-		it( 'should create proper WrapOperation from json object #1', () => {
-			const op = new WrapOperation(
-				new Position( root, [ 0 ] ),
-				1,
-				new Position( doc.graveyard, [ 0 ] ),
-				doc.version
-			);
-
-			const serialized = op.toJSON();
-			const deserialized = WrapOperation.fromJSON( serialized, doc );
-
-			expect( deserialized ).to.deep.equal( op );
-		} );
-
-		it( 'should create proper WrapOperation from json object #2', () => {
-			const op = new WrapOperation(
-				new Position( root, [ 0 ] ),
-				1,
-				new Element( 'blockQuote' ),
-				doc.version
-			);
-
-			const serialized = op.toJSON();
-			const deserialized = WrapOperation.fromJSON( serialized, doc );
-
-			expect( deserialized ).to.deep.equal( op );
-		} );
-	} );
-} );

+ 0 - 112
packages/ckeditor5-engine/tests/model/position.js

@@ -17,8 +17,6 @@ import MoveOperation from '../../src/model/operation/moveoperation';
 import RenameOperation from '../../src/model/operation/renameoperation';
 import MergeOperation from '../../src/model/operation/mergeoperation';
 import SplitOperation from '../../src/model/operation/splitoperation';
-import WrapOperation from '../../src/model/operation/wrapoperation';
-import UnwrapOperation from '../../src/model/operation/unwrapoperation';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
@@ -809,116 +807,6 @@ describe( 'Position', () => {
 				expect( transformed.path ).to.deep.equal( [ 3, 7 ] );
 			} );
 		} );
-
-		describe( 'by WrapOperation', () => {
-			it( 'position is before the wrapped range', () => {
-				const op = new WrapOperation( new Position( root, [ 3, 3 ] ), 3, new Element( 'paragraph' ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 2 ] );
-			} );
-
-			it( 'position is at the beginning of wrapped range and sticks to previous', () => {
-				pos.stickiness = 'toPrevious';
-
-				const op = new WrapOperation( new Position( root, [ 3, 2 ] ), 3, new Element( 'paragraph' ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 2 ] );
-			} );
-
-			it( 'position is at the beginning of wrapped range and sticks to next', () => {
-				pos.stickiness = 'toNext';
-
-				const op = new WrapOperation( new Position( root, [ 3, 2 ] ), 3, new Element( 'paragraph' ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 2, 0 ] );
-			} );
-
-			it( 'position is inside wrapped range', () => {
-				const op = new WrapOperation( new Position( root, [ 3, 1 ] ), 3, new Element( 'paragraph' ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 1, 1 ] );
-			} );
-
-			it( 'position is at the end of wrapped range and sticks to previous', () => {
-				pos.stickiness = 'toPrevious';
-
-				const op = new WrapOperation( new Position( root, [ 3, 0 ] ), 2, new Element( 'paragraph' ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 0, 2 ] );
-			} );
-
-			it( 'position is at the end of wrapped range and sticks to next', () => {
-				pos.stickiness = 'toNext';
-
-				const op = new WrapOperation( new Position( root, [ 3, 0 ] ), 2, new Element( 'paragraph' ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 1 ] );
-			} );
-
-			it( 'position is after the wrapped range', () => {
-				const op = new WrapOperation( new Position( root, [ 3, 0 ] ), 1, new Element( 'paragraph' ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 2 ] );
-			} );
-
-			it( 'position is inside the graveyard and the operation uses element from graveyard', () => {
-				pos = new Position( doc.graveyard, [ 1 ] );
-
-				const op = new WrapOperation( new Position( root, [ 3, 0 ] ), 1, new Position( doc.graveyard, [ 0 ] ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 0 ] );
-			} );
-		} );
-
-		describe( 'by UnwrapOperation', () => {
-			it( 'position is before unwrapped element', () => {
-				const op = new UnwrapOperation( new Position( root, [ 3, 2, 0 ] ), 3, new Position( doc.graveyard, [ 0 ] ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 2 ] );
-			} );
-
-			it( 'position is inside unwrapped element', () => {
-				const op = new UnwrapOperation( new Position( root, [ 3, 0 ] ), 3, new Position( doc.graveyard, [ 0 ] ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 5 ] );
-			} );
-
-			it( 'position is after unwrapped element', () => {
-				const op = new UnwrapOperation( new Position( root, [ 3, 1, 0 ] ), 3, new Position( doc.graveyard, [ 0 ] ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 3, 4 ] );
-			} );
-
-			it( 'position is in graveyard', () => {
-				pos = new Position( doc.graveyard, [ 0 ] );
-
-				const op = new UnwrapOperation( new Position( root, [ 3, 2, 0 ] ), 3, new Position( doc.graveyard, [ 0 ] ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 1 ] );
-			} );
-
-			it( 'unwrap is in the graveyard and position is before the unwrapped node', () => {
-				// This is an edge case scenario for unwrap operation that is unwrapping an element which is already in graveyard.
-				pos = new Position( doc.graveyard, [ 0 ] );
-
-				const op = new UnwrapOperation( new Position( doc.graveyard, [ 0, 0 ] ), 0, new Position( doc.graveyard, [ 0 ] ), 1 );
-				const transformed = pos.getTransformedByOperation( op );
-
-				expect( transformed.path ).to.deep.equal( [ 0 ] );
-			} );
-		} );
 	} );
 
 	describe( '_getTransformedByInsertion()', () => {

+ 0 - 103
packages/ckeditor5-engine/tests/model/range.js

@@ -16,8 +16,6 @@ import MoveOperation from '../../src/model/operation/moveoperation';
 import RenameOperation from '../../src/model/operation/renameoperation';
 import MergeOperation from '../../src/model/operation/mergeoperation';
 import SplitOperation from '../../src/model/operation/splitoperation';
-import WrapOperation from '../../src/model/operation/wrapoperation';
-import UnwrapOperation from '../../src/model/operation/unwrapoperation';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 
 describe( 'Range', () => {
@@ -1201,107 +1199,6 @@ describe( 'Range', () => {
 				expect( transformed[ 0 ].end.path ).to.deep.equal( [ 2 ] );
 			} );
 		} );
-
-		describe( 'by WrapOperation', () => {
-			it( 'maintans start position when wrapping element in which the range starts and ends', () => {
-				// <p>f[o]o</p><p>bar</p>
-				range.start = new Position( root, [ 0, 1 ] );
-				range.end = new Position( root, [ 0, 2 ] );
-
-				const wrapElement = new Element( 'w' );
-				const op = new WrapOperation( new Position( root, [ 0 ] ), 1, wrapElement, 1 );
-
-				const transformed = range.getTransformedByOperation( op );
-
-				// <w><p>f[o]o</p></w><p>bar</p>
-				expect( transformed.length ).to.equal( 1 );
-				expect( transformed[ 0 ].start.path ).to.deep.equal( [ 0, 0, 1 ] );
-				expect( transformed[ 0 ].end.path ).to.deep.equal( [ 0, 0, 2 ] );
-			} );
-
-			it( 'maintans start position when wrapping element in which the range starts but not ends', () => {
-				// <p>f[oo</p><p>b]ar</p>
-				range.start = new Position( root, [ 0, 1 ] );
-				range.end = new Position( root, [ 1, 1 ] );
-
-				const wrapElement = new Element( 'w' );
-				const op = new WrapOperation( new Position( root, [ 0 ] ), 1, wrapElement, 1 );
-
-				const transformed = range.getTransformedByOperation( op );
-
-				// <w><p>f[oo</p></w><p>b]ar</p>
-				expect( transformed.length ).to.equal( 1 );
-				expect( transformed[ 0 ].start.path ).to.deep.equal( [ 0, 0, 1 ] );
-				expect( transformed[ 0 ].end.path ).to.deep.equal( [ 1, 1 ] );
-			} );
-
-			it( 'maintans end position when wrapping element in which the range ends but not starts', () => {
-				// <p>f[oo</p><p>b]ar</p>
-				range.start = new Position( root, [ 0, 1 ] );
-				range.end = new Position( root, [ 1, 1 ] );
-
-				const wrapElement = new Element( 'w' );
-				const op = new WrapOperation( new Position( root, [ 1 ] ), 1, wrapElement, 1 );
-
-				const transformed = range.getTransformedByOperation( op );
-
-				// <p>f[oo</p><w><p>b]ar</p></w>
-				expect( transformed.length ).to.equal( 1 );
-				expect( transformed[ 0 ].start.path ).to.deep.equal( [ 0, 1 ] );
-				expect( transformed[ 0 ].end.path ).to.deep.equal( [ 1, 0, 1 ] );
-			} );
-		} );
-
-		describe( 'by UnwrapOperation', () => {
-			it( 'maintans start position when wrapping element in which the range starts and ends', () => {
-				// <w><p>f[o]o</p></w><p>bar</p>
-				range.start = new Position( root, [ 0, 0, 1 ] );
-				range.end = new Position( root, [ 0, 0, 2 ] );
-
-				const unwrapPosition = new Position( root, [ 0, 0 ] );
-				const op = new UnwrapOperation( unwrapPosition, 1, gyPos, 1 );
-
-				const transformed = range.getTransformedByOperation( op );
-
-				// <p>f[o]o</p><p>bar</p>
-				expect( transformed.length ).to.equal( 1 );
-				expect( transformed[ 0 ].start.path ).to.deep.equal( [ 0, 1 ] );
-				expect( transformed[ 0 ].end.path ).to.deep.equal( [ 0, 2 ] );
-			} );
-
-			it( 'maintans start position when unwrapping element in which the range starts but not ends', () => {
-				// <w><p>f[oo</p></w><p>b]ar</p>
-				range.start = new Position( root, [ 0, 0, 1 ] );
-				range.end = new Position( root, [ 1, 1 ] );
-
-				const unwrapPosition = new Position( root, [ 0, 0 ] );
-				const op = new UnwrapOperation( unwrapPosition, 1, gyPos, 1 );
-
-				const transformed = range.getTransformedByOperation( op );
-
-				// <p>f[oo</p><p>b]ar</p>
-				expect( transformed.length ).to.equal( 1 );
-
-				expect( transformed[ 0 ].start.path ).to.deep.equal( [ 0, 1 ] );
-				expect( transformed[ 0 ].end.path ).to.deep.equal( [ 1, 1 ] );
-			} );
-
-			it( 'maintans end position when unwrapping element in which the range ends but not starts', () => {
-				// <p>f[oo</p><w><p>b]ar</p></w>
-				range.start = new Position( root, [ 0, 1 ] );
-				range.end = new Position( root, [ 1, 0, 1 ] );
-
-				const unwrapPosition = new Position( root, [ 1, 0 ] );
-				const op = new UnwrapOperation( unwrapPosition, 1, gyPos, 1 );
-
-				const transformed = range.getTransformedByOperation( op );
-
-				// <p>f[oo</p><p>b]ar</p>
-				expect( transformed.length ).to.equal( 1 );
-				expect( transformed[ 0 ].start.path ).to.deep.equal( [ 0, 1 ] );
-				expect( transformed[ 0 ].end.path ).to.deep.equal( [ 1, 1 ] );
-			} );
-		} );
 	} );
 
 	describe( 'getTransformedByOperations()', () => {