8
0
Quellcode durchsuchen

ChangeOperation and ChangeDelta renamed to AttributeOperation and AttributeDelta.

Szymon Cofalik vor 10 Jahren
Ursprung
Commit
b72ad40595

+ 1 - 1
packages/ckeditor5-utils/src/document/batch.js

@@ -13,7 +13,7 @@ CKEDITOR.define( [
 	'document/delta/batch-base',
 	'document/delta/insertdelta',
 	'document/delta/removedelta',
-	'document/delta/changedelta',
+	'document/delta/attributedelta',
 	'document/delta/splitdelta',
 	'document/delta/mergedelta'
 ], ( Batch ) => {

+ 13 - 13
packages/ckeditor5-utils/src/document/delta/changedelta.js

@@ -8,20 +8,20 @@
 CKEDITOR.define( [
 	'document/delta/delta',
 	'document/delta/register',
-	'document/operation/changeoperation',
+	'document/operation/attributeoperation',
 	'document/position',
 	'document/range',
 	'document/attribute',
 	'document/element'
-], ( Delta, register, ChangeOperation, Position, Range, Attribute, Element ) => {
+], ( Delta, register, AttributeOperation, Position, Range, Attribute, Element ) => {
 	/**
 	 * To provide specific OT behavior and better collisions solving, change methods ({@link document.Batch#setAttr}
-	 * and {@link document.Batch#removeAttr}) use `ChangeDelta` class which inherits from the `Delta` class and may
+	 * and {@link document.Batch#removeAttr}) use `AttributeDelta` class which inherits from the `Delta` class and may
 	 * overwrite some methods.
 	 *
-	 * @class document.delta.ChangeDelta
+	 * @class document.delta.AttributeDelta
 	 */
-	class ChangeDelta extends Delta {}
+	class AttributeDelta extends Delta {}
 
 	/**
 	 * Sets the value of the attribute of the node or on the range.
@@ -34,7 +34,7 @@ CKEDITOR.define( [
 	 * @param {document.Node|document.Range} nodeOrRange Node or range on which the attribute will be set.
 	 */
 	register( 'setAttr', function( key, value, nodeOrRange ) {
-		change( this, key, value, nodeOrRange );
+		attribute( this, key, value, nodeOrRange );
 
 		return this;
 	} );
@@ -49,13 +49,13 @@ CKEDITOR.define( [
 	 * @param {document.Node|document.Range} nodeOrRange Node or range on which the attribute will be removed.
 	 */
 	register( 'removeAttr', function( key, nodeOrRange ) {
-		change( this, key, null, nodeOrRange );
+		attribute( this, key, null, nodeOrRange );
 
 		return this;
 	} );
 
-	function change( batch, key, value, nodeOrRange ) {
-		const delta = new ChangeDelta();
+	function attribute( batch, key, value, nodeOrRange ) {
+		const delta = new AttributeDelta();
 
 		if ( nodeOrRange instanceof Range ) {
 			changeRange( batch.doc, delta, key, value, nodeOrRange );
@@ -81,7 +81,7 @@ CKEDITOR.define( [
 				range = new Range( Position.createBefore( node ), Position.createAfter( node ) );
 			}
 
-			const operation = new ChangeOperation(
+			const operation = new AttributeOperation(
 					range,
 					previousValue ? new Attribute( key, previousValue ) : null,
 					value ? new Attribute( key, value ) : null,
@@ -93,7 +93,7 @@ CKEDITOR.define( [
 		}
 	}
 
-	// Because change operation needs to have the same attribute value on the whole range, this function split the range
+	// Because attribute operation needs to have the same attribute value on the whole range, this function split the range
 	// into smaller parts.
 	function changeRange( doc, delta, key, value, range ) {
 		// Position of the last split, the beginning of the new range.
@@ -139,7 +139,7 @@ CKEDITOR.define( [
 		}
 
 		function addOperation() {
-			const operation = new ChangeOperation(
+			const operation = new AttributeOperation(
 					new Range( lastSplitPosition, position ),
 					valueBefore ? new Attribute( key, valueBefore ) : null,
 					value ? new Attribute( key, value ) : null,
@@ -151,5 +151,5 @@ CKEDITOR.define( [
 		}
 	}
 
-	return ChangeDelta;
+	return AttributeDelta;
 } );

+ 1 - 1
packages/ckeditor5-utils/src/document/node.js

@@ -33,7 +33,7 @@ CKEDITOR.define( [ 'document/attribute', 'utils', 'ckeditorerror' ], ( Attribute
 			/**
 			 * Attributes set.
 			 *
-			 * Attributes of nodes attached to the document can be changed only be the {@link document.operation.ChangeOperation}.
+			 * Attributes of nodes attached to the document can be changed only be the {@link document.operation.AttributeOperation}.
 			 *
 			 * @private
 			 * @property {Set} _attrs

+ 12 - 12
packages/ckeditor5-utils/src/document/operation/changeoperation.js

@@ -12,11 +12,11 @@ CKEDITOR.define( [
 	/**
 	 * Operation to change nodes' attribute. Using this class you can add, remove or change value of the attribute.
 	 *
-	 * @class document.operation.ChangeOperation
+	 * @class document.operation.AttributeOperation
 	 */
-	class ChangeOperation extends Operation {
+	class AttributeOperation extends Operation {
 		/**
-		 * Creates a change operation.
+		 * Creates an operation that changes, removes or adds attributes.
 		 *
 		 * If only the new attribute is set, then it will be inserted. Note that in all nodes in ranges there must be
 		 * no attributes with the same key as the new attribute.
@@ -66,11 +66,11 @@ CKEDITOR.define( [
 		}
 
 		clone() {
-			return new ChangeOperation( this.range.clone(), this.oldAttr, this.newAttr, this.baseVersion );
+			return new AttributeOperation( this.range.clone(), this.oldAttr, this.newAttr, this.baseVersion );
 		}
 
 		getReversed() {
-			return new ChangeOperation( this.range, this.newAttr, this.oldAttr, this.baseVersion + 1 );
+			return new AttributeOperation( this.range, this.newAttr, this.oldAttr, this.baseVersion + 1 );
 		}
 
 		_execute() {
@@ -82,12 +82,12 @@ CKEDITOR.define( [
 				/**
 				 * Old and new attributes should have the same keys.
 				 *
-				 * @error operation-change-different-keys
+				 * @error operation-attribute-different-keys
 				 * @param {document.Attribute} oldAttr
 				 * @param {document.Attribute} newAttr
 				 */
 				throw new CKEditorError(
-					'operation-change-different-keys: Old and new attributes should have the same keys.',
+					'operation-attribute-different-keys: Old and new attributes should have the same keys.',
 					{ oldAttr: oldAttr, newAttr: newAttr } );
 			}
 
@@ -98,12 +98,12 @@ CKEDITOR.define( [
 						/**
 						 * The attribute which should be removed does not exists for the given node.
 						 *
-						 * @error operation-change-no-attr-to-remove
+						 * @error operation-attribute-no-attr-to-remove
 						 * @param {document.Node} node
 						 * @param {document.Attribute} attr
 						 */
 						throw new CKEditorError(
-							'operation-change-no-attr-to-remove: The attribute which should be removed does not exists for given node.',
+							'operation-attribute-no-attr-to-remove: The attribute which should be removed does not exists for given node.',
 							{ node: value.node, attr: oldAttr } );
 					}
 
@@ -122,12 +122,12 @@ CKEDITOR.define( [
 						/**
 						 * The attribute with given key already exists for the given node.
 						 *
-						 * @error operation-change-attr-exists
+						 * @error operation-attribute-attr-exists
 						 * @param {document.Node} node
 						 * @param {document.Attribute} attr
 						 */
 						throw new CKEditorError(
-							'operation-change-attr-exists: The attribute with given key already exists.',
+							'operation-attribute-attr-exists: The attribute with given key already exists.',
 							{ node: value.node, attr: newAttr } );
 					}
 
@@ -139,5 +139,5 @@ CKEDITOR.define( [
 		}
 	}
 
-	return ChangeOperation;
+	return AttributeOperation;
 } );

+ 20 - 20
packages/ckeditor5-utils/src/document/operation/transform.js

@@ -45,12 +45,12 @@
 
 CKEDITOR.define( [
 	'document/operation/insertoperation',
-	'document/operation/changeoperation',
+	'document/operation/attributeoperation',
 	'document/operation/moveoperation',
 	'document/operation/nooperation',
 	'document/range',
 	'utils'
-], ( InsertOperation, ChangeOperation, MoveOperation, NoOperation, Range, utils ) => {
+], ( InsertOperation, AttributeOperation, MoveOperation, NoOperation, Range, utils ) => {
 	const ot = {
 		InsertOperation: {
 			// Transforms InsertOperation `a` by InsertOperation `b`. Accepts a flag stating whether `a` is more important
@@ -65,7 +65,7 @@ CKEDITOR.define( [
 				return [ transformed ];
 			},
 
-			ChangeOperation: doNotUpdate,
+			AttributeOperation: doNotUpdate,
 
 			// Transforms InsertOperation `a` by MoveOperation `b`. Accepts a flag stating whether `a` is more important
 			// than `b` when it comes to resolving conflicts. Returns results as an array of operations.
@@ -79,15 +79,15 @@ CKEDITOR.define( [
 			}
 		},
 
-		ChangeOperation: {
-			// Transforms ChangeOperation `a` by InsertOperation `b`. Returns results as an array of operations.
+		AttributeOperation: {
+			// Transforms AttributeOperation `a` by InsertOperation `b`. Returns results as an array of operations.
 			InsertOperation( a, b ) {
 				// Transform this operation's range.
 				const ranges = a.range.getTransformedByInsertion( b.position, b.nodeList.length );
 
 				// Map transformed range(s) to operations and return them.
 				return ranges.reverse().map( ( range ) => {
-					return new ChangeOperation(
+					return new AttributeOperation(
 						range,
 						a.oldAttr,
 						a.newAttr,
@@ -96,9 +96,9 @@ CKEDITOR.define( [
 				} );
 			},
 
-			// Transforms ChangeOperation `a` by ChangeOperation `b`. Accepts a flag stating whether `a` is more important
+			// Transforms AttributeOperation `a` by AttributeOperation `b`. Accepts a flag stating whether `a` is more important
 			// than `b` when it comes to resolving conflicts. Returns results as an array of operations.
-			ChangeOperation( a, b, isStrong ) {
+			AttributeOperation( a, b, isStrong ) {
 				if ( haveConflictingAttributes( a, b ) ) {
 					// If operations attributes are in conflict, check if their ranges intersect and manage them properly.
 					let operations = [];
@@ -106,7 +106,7 @@ CKEDITOR.define( [
 					// First, we want to apply change to the part of a range that has not been changed by the other operation.
 					operations = operations.concat(
 						a.range.getDifference( b.range ).map( ( range ) => {
-							return new ChangeOperation( range, a.oldAttr, a.newAttr, a.baseVersion );
+							return new AttributeOperation( range, a.oldAttr, a.newAttr, a.baseVersion );
 						} )
 					);
 
@@ -117,7 +117,7 @@ CKEDITOR.define( [
 						const common = a.range.getIntersection( b.range );
 
 						if ( common !== null ) {
-							operations.push( new ChangeOperation( common, b.oldAttr, a.newAttr, a.baseVersion ) );
+							operations.push( new AttributeOperation( common, b.oldAttr, a.newAttr, a.baseVersion ) );
 						}
 					}
 
@@ -134,7 +134,7 @@ CKEDITOR.define( [
 				}
 			},
 
-			// Transforms ChangeOperation `a` by MoveOperation `b`. Returns results as an array of operations.
+			// Transforms AttributeOperation `a` by MoveOperation `b`. Returns results as an array of operations.
 			MoveOperation( a, b ) {
 				// Convert MoveOperation properties into a range.
 				const rangeB = Range.createFromPositionAndOffset( b.sourcePosition, b.howMany );
@@ -145,7 +145,7 @@ CKEDITOR.define( [
 				// This will aggregate transformed ranges.
 				let ranges = [];
 
-				// Difference is a part of changed range that is modified by ChangeOperation but are not affected
+				// Difference is a part of changed range that is modified by AttributeOperation but are not affected
 				// by MoveOperation. This can be zero, one or two ranges (if moved range is inside changed range).
 				// If two ranges were returned it means that rangeB was inside rangeA. We will cover rangeB later.
 				// Right now we will make a simplification and join difference ranges and transform them as one.
@@ -157,7 +157,7 @@ CKEDITOR.define( [
 				if ( difference !== null ) {
 					// MoveOperation removes nodes from their original position. We acknowledge this by proper transformation.
 					// Take the start and the end of the range and transform them by deletion of moved nodes.
-					// Note that if rangeB was inside ChangeOperation range, only difference.end will be transformed.
+					// Note that if rangeB was inside AttributeOperation range, only difference.end will be transformed.
 					// This nicely covers the joining simplification we did in the previous step.
 					difference.start = difference.start.getTransformedByDeletion( b.sourcePosition, b.howMany );
 					difference.end = difference.end.getTransformedByDeletion( b.sourcePosition, b.howMany );
@@ -182,7 +182,7 @@ CKEDITOR.define( [
 
 				// Map transformed range(s) to operations and return them.
 				return ranges.map( ( range ) => {
-					return new ChangeOperation(
+					return new AttributeOperation(
 						range,
 						a.oldAttr,
 						a.newAttr,
@@ -214,7 +214,7 @@ CKEDITOR.define( [
 				} );
 			},
 
-			ChangeOperation: doNotUpdate,
+			AttributeOperation: doNotUpdate,
 
 			// Transforms MoveOperation `a` by MoveOperation `b`. Accepts a flag stating whether `a` is more important
 			// than `b` when it comes to resolving conflicts. Returns results as an array of operations.
@@ -333,8 +333,8 @@ CKEDITOR.define( [
 
 		if ( a instanceof InsertOperation ) {
 			group = ot.InsertOperation;
-		} else if ( a instanceof ChangeOperation ) {
-			group = ot.ChangeOperation;
+		} else if ( a instanceof AttributeOperation ) {
+			group = ot.AttributeOperation;
 		} else if ( a instanceof MoveOperation ) {
 			group = ot.MoveOperation;
 		} else {
@@ -344,8 +344,8 @@ CKEDITOR.define( [
 		if ( group ) {
 			if ( b instanceof InsertOperation ) {
 				algorithm = group.InsertOperation;
-			} else if ( b instanceof ChangeOperation ) {
-				algorithm = group.ChangeOperation;
+			} else if ( b instanceof AttributeOperation ) {
+				algorithm = group.AttributeOperation;
 			} else if ( b instanceof MoveOperation ) {
 				algorithm = group.MoveOperation;
 			} else {
@@ -379,7 +379,7 @@ CKEDITOR.define( [
 		return a.targetPosition.getTransformedByDeletion( b.sourcePosition, b.howMany ) === null;
 	}
 
-	// Takes two ChangeOperations and checks whether their attributes are in conflict.
+	// Takes two AttributeOperations and checks whether their attributes are in conflict.
 	// This happens when both operations changes an attribute with the same key and they either set different
 	// values for this attribute or one of them removes it while the other one sets it.
 	// Returns true if attributes are in conflict.

packages/ckeditor5-utils/tests/document/deltas/changedelta.js → packages/ckeditor5-utils/tests/document/deltas/attributedelta.js


+ 26 - 26
packages/ckeditor5-utils/tests/document/operation/changeoperation.js

@@ -14,7 +14,7 @@ const getIteratorCount = bender.tools.core.getIteratorCount;
 
 const modules = bender.amd.require(
 	'document/document',
-	'document/operation/changeoperation',
+	'document/operation/attributeoperation',
 	'document/position',
 	'document/range',
 	'document/character',
@@ -23,12 +23,12 @@ const modules = bender.amd.require(
 	'ckeditorerror'
 );
 
-describe( 'ChangeOperation', () => {
-	let Document, ChangeOperation, Position, Range, Character, Attribute, Text, CKEditorError;
+describe( 'AttributeOperation', () => {
+	let Document, AttributeOperation, Position, Range, Character, Attribute, Text, CKEditorError;
 
 	before( () => {
 		Document = modules[ 'document/document' ];
-		ChangeOperation = modules[ 'document/operation/changeoperation' ];
+		AttributeOperation = modules[ 'document/operation/attributeoperation' ];
 		Position = modules[ 'document/position' ];
 		Range = modules[ 'document/range' ];
 		Character = modules[ 'document/character' ];
@@ -45,14 +45,14 @@ describe( 'ChangeOperation', () => {
 	} );
 
 	it( 'should have proper type', () => {
-		const opp = new ChangeOperation(
+		const op = new AttributeOperation(
 			new Range( new Position( root, [ 0 ] ), new Position( root, [ 2 ] ) ),
 			null,
 			new Attribute( 'isNew', true ),
 			doc.version
 		);
 
-		expect( opp.type ).to.equal( 'attr' );
+		expect( op.type ).to.equal( 'attr' );
 	} );
 
 	it( 'should insert attribute to the set of nodes', () => {
@@ -61,7 +61,7 @@ describe( 'ChangeOperation', () => {
 		root.insertChildren( 0, 'bar' );
 
 		doc.applyOperation(
-			new ChangeOperation(
+			new AttributeOperation(
 				new Range( new Position( root, [ 0 ] ), new Position( root, [ 2 ] ) ),
 				null,
 				newAttr,
@@ -84,7 +84,7 @@ describe( 'ChangeOperation', () => {
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, barAttr ] ) );
 
 		doc.applyOperation(
-			new ChangeOperation(
+			new AttributeOperation(
 				new Range( new Position( root, [ 0 ] ), new Position( root, [ 1 ] ) ),
 				null,
 				newAttr,
@@ -107,7 +107,7 @@ describe( 'ChangeOperation', () => {
 		root.insertChildren( 0, new Text( 'bar', [ oldAttr ] ) );
 
 		doc.applyOperation(
-			new ChangeOperation(
+			new AttributeOperation(
 				new Range( new Position( root, [ 0 ] ), new Position( root, [ 2 ] ) ),
 				oldAttr,
 				newAttr,
@@ -134,7 +134,7 @@ describe( 'ChangeOperation', () => {
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, x1Attr, barAttr ] ) );
 
 		doc.applyOperation(
-			new ChangeOperation(
+			new AttributeOperation(
 				new Range( new Position( root, [ 0 ] ), new Position( root, [ 1 ] ) ),
 				x1Attr,
 				x2Attr,
@@ -158,7 +158,7 @@ describe( 'ChangeOperation', () => {
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, xAttr, barAttr ] ) );
 
 		doc.applyOperation(
-			new ChangeOperation(
+			new AttributeOperation(
 				new Range( new Position( root, [ 0 ] ), new Position( root, [ 1 ] ) ),
 				xAttr,
 				null,
@@ -173,14 +173,14 @@ describe( 'ChangeOperation', () => {
 		expect( root.getChild( 0 ).hasAttr( barAttr ) ).to.be.true;
 	} );
 
-	it( 'should create a change operation as a reverse', () => {
+	it( 'should create an AttributeOperation as a reverse', () => {
 		let oldAttr = new Attribute( 'x', 'old' );
 		let newAttr = new Attribute( 'x', 'new' );
 		let range = new Range( new Position( root, [ 0 ] ), new Position( root, [ 3 ] ) );
-		let operation = new ChangeOperation( range, oldAttr, newAttr, doc.version );
+		let operation = new AttributeOperation( range, oldAttr, newAttr, doc.version );
 		let reverse = operation.getReversed();
 
-		expect( reverse ).to.be.an.instanceof( ChangeOperation );
+		expect( reverse ).to.be.an.instanceof( AttributeOperation );
 		expect( reverse.baseVersion ).to.equal( 1 );
 		expect( reverse.range ).to.equal( range );
 		expect( reverse.oldAttr ).to.equal( newAttr );
@@ -192,7 +192,7 @@ describe( 'ChangeOperation', () => {
 
 		root.insertChildren( 0, 'bar' );
 
-		let operation = new ChangeOperation(
+		let operation = new AttributeOperation(
 			new Range( new Position( root, [ 0 ] ), new Position( root, [ 3 ] ) ),
 			null,
 			newAttr,
@@ -217,7 +217,7 @@ describe( 'ChangeOperation', () => {
 
 		root.insertChildren( 0, new Text( 'bar', [ oldAttr ] ) );
 
-		let operation = new ChangeOperation(
+		let operation = new AttributeOperation(
 			new Range( new Position( root, [ 0 ] ), new Position( root, [ 3 ] ) ),
 			oldAttr,
 			newAttr,
@@ -245,7 +245,7 @@ describe( 'ChangeOperation', () => {
 
 		root.insertChildren( 0, new Text( 'bar', [ fooAttr ] ) );
 
-		let operation = new ChangeOperation(
+		let operation = new AttributeOperation(
 			new Range( new Position( root, [ 0 ] ), new Position( root, [ 3 ] ) ),
 			fooAttr,
 			null,
@@ -275,14 +275,14 @@ describe( 'ChangeOperation', () => {
 
 		expect( () => {
 			doc.applyOperation(
-				new ChangeOperation(
+				new AttributeOperation(
 					new Range( new Position( root, [ 0 ] ), new Position( root, [ 1 ] ) ),
 					fooAttr,
 					null,
 					doc.version
 				)
 			);
-		} ).to.throw( CKEditorError, /operation-change-no-attr-to-remove/ );
+		} ).to.throw( CKEditorError, /operation-attribute-no-attr-to-remove/ );
 	} );
 
 	it( 'should throw an error when one try to insert and the attribute already exists', () => {
@@ -293,14 +293,14 @@ describe( 'ChangeOperation', () => {
 
 		expect( () => {
 			doc.applyOperation(
-				new ChangeOperation(
+				new AttributeOperation(
 					new Range( new Position( root, [ 0 ] ), new Position( root, [ 1 ] ) ),
 					null,
 					x2Attr,
 					doc.version
 				)
 			);
-		} ).to.throw( CKEditorError, /operation-change-attr-exists/ );
+		} ).to.throw( CKEditorError, /operation-attribute-attr-exists/ );
 	} );
 
 	it( 'should throw an error when one try to change and the new and old attributes have different keys', () => {
@@ -311,30 +311,30 @@ describe( 'ChangeOperation', () => {
 
 		expect( () => {
 			doc.applyOperation(
-				new ChangeOperation(
+				new AttributeOperation(
 					new Range( new Position( root, [ 0 ] ), new Position( root, [ 1 ] ) ),
 					fooAttr,
 					barAttr,
 					doc.version
 				)
 			);
-		} ).to.throw( CKEditorError, /operation-change-different-keys/ );
+		} ).to.throw( CKEditorError, /operation-attribute-different-keys/ );
 	} );
 
-	it( 'should create operation with the same parameters when cloned', () => {
+	it( 'should create an AttributeOperation with the same parameters when cloned', () => {
 		let range = new Range( new Position( root, [ 0 ] ), new Position( root, [ 1 ] ) );
 		let oldAttr = new Attribute( 'foo', 'old' );
 		let newAttr = new Attribute( 'foo', 'bar' );
 		let baseVersion = doc.version;
 
-		let op = new ChangeOperation( range, oldAttr, newAttr, baseVersion );
+		let op = new AttributeOperation( range, oldAttr, newAttr, baseVersion );
 
 		let 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( ChangeOperation );
+		expect( clone ).to.be.instanceof( AttributeOperation );
 		expect( clone.range.isEqual( range ) ).to.be.true;
 		expect( clone.oldAttr.isEqual( oldAttr ) ).to.be.true;
 		expect( clone.newAttr.isEqual( newAttr ) ).to.be.true;

+ 28 - 28
packages/ckeditor5-utils/tests/document/operation/transform.js

@@ -18,13 +18,13 @@ const modules = bender.amd.require(
 	'document/attribute',
 	'document/operation/transform',
 	'document/operation/insertoperation',
-	'document/operation/changeoperation',
+	'document/operation/attributeoperation',
 	'document/operation/moveoperation',
 	'document/operation/nooperation'
 );
 
 describe( 'transform', () => {
-	let RootElement, Node, Position, Range, Attribute, InsertOperation, ChangeOperation, MoveOperation, NoOperation;
+	let RootElement, Node, Position, Range, Attribute, InsertOperation, AttributeOperation, MoveOperation, NoOperation;
 	let transform;
 
 	before( () => {
@@ -34,7 +34,7 @@ describe( 'transform', () => {
 		Range = modules[ 'document/range' ];
 		Attribute = modules[ 'document/attribute' ];
 		InsertOperation = modules[ 'document/operation/insertoperation' ];
-		ChangeOperation = modules[ 'document/operation/changeoperation' ];
+		AttributeOperation = modules[ 'document/operation/attributeoperation' ];
 		MoveOperation = modules[ 'document/operation/moveoperation' ];
 		NoOperation = modules[ 'document/operation/nooperation' ];
 
@@ -187,13 +187,13 @@ describe( 'transform', () => {
 			} );
 		} );
 
-		describe( 'by ChangeOperation', () => {
+		describe( 'by AttributeOperation', () => {
 			it( 'no position update', () => {
 				let rangeStart = position.clone();
 				let rangeEnd = position.clone();
 				rangeEnd.offset += 2;
 
-				let transformBy = new ChangeOperation(
+				let transformBy = new AttributeOperation(
 					new Range( rangeStart, rangeEnd ),
 					null,
 					new Attribute( 'foo', 'bar' ),
@@ -410,7 +410,7 @@ describe( 'transform', () => {
 		} );
 	} );
 
-	describe( 'ChangeOperation', () => {
+	describe( 'AttributeOperation', () => {
 		let start, end, range, oldAttr, newAttr, anotherOldAttr, anotherNewAttr;
 
 		beforeEach( () => {
@@ -421,7 +421,7 @@ describe( 'transform', () => {
 			anotherNewAttr = new Attribute( oldAttr.key, 'anothernew' );
 
 			expected = {
-				type: ChangeOperation,
+				type: AttributeOperation,
 				oldAttr: oldAttr,
 				newAttr: newAttr,
 				baseVersion: baseVersion + 1
@@ -435,7 +435,7 @@ describe( 'transform', () => {
 
 				range = new Range( start, end );
 
-				op = new ChangeOperation( range, oldAttr, newAttr, baseVersion );
+				op = new AttributeOperation( range, oldAttr, newAttr, baseVersion );
 
 				expected.range = new Range( start.clone(), end.clone() );
 			} );
@@ -549,9 +549,9 @@ describe( 'transform', () => {
 				} );
 			} );
 
-			describe( 'by ChangeOperation', () => {
+			describe( 'by AttributeOperation', () => {
 				it( 'attributes have different key: no operation update', () => {
-					let transformBy = new ChangeOperation(
+					let transformBy = new AttributeOperation(
 						range.clone(),
 						new Attribute( 'abc', true ),
 						new Attribute( 'abc', false ),
@@ -565,7 +565,7 @@ describe( 'transform', () => {
 				} );
 
 				it( 'attributes set same value: no operation update', () => {
-					let transformBy = new ChangeOperation(
+					let transformBy = new AttributeOperation(
 						range.clone(),
 						oldAttr,
 						newAttr,
@@ -581,7 +581,7 @@ describe( 'transform', () => {
 				it( 'both operations removes attribute: no operation update', () => {
 					op.newAttr = null;
 
-					let transformBy = new ChangeOperation(
+					let transformBy = new AttributeOperation(
 						new Range( new Position( root, [ 1, 1, 4 ] ), new Position( root, [ 3 ] ) ),
 						anotherOldAttr,
 						null,
@@ -598,7 +598,7 @@ describe( 'transform', () => {
 
 				describe( 'that is less important and', () => {
 					it( 'range does not intersect original range: no operation update', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 3, 0 ] ), new Position( root, [ 4 ] ) ),
 							anotherOldAttr,
 							null,
@@ -612,7 +612,7 @@ describe( 'transform', () => {
 					} );
 
 					it( 'range contains original range: update oldAttr', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1, 1, 4 ] ), new Position( root, [ 3 ] ) ),
 							anotherOldAttr,
 							null,
@@ -632,7 +632,7 @@ describe( 'transform', () => {
 						// Get more test cases and better code coverage
 						op.newAttr = null;
 
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1, 4, 2 ] ), new Position( root, [ 3 ] ) ),
 							anotherOldAttr,
 							// Get more test cases and better code coverage
@@ -660,7 +660,7 @@ describe( 'transform', () => {
 
 					// [  range transformed by  <   ]  original range  >
 					it( 'range intersects on right: split into two operations, update oldAttr', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1 ] ), new Position( root, [ 2, 1 ] ) ),
 							anotherOldAttr,
 							null,
@@ -684,7 +684,7 @@ describe( 'transform', () => {
 					} );
 
 					it( 'range is inside original range: split into three operations, update oldAttr', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1, 4, 1 ] ), new Position( root, [ 2, 1 ] ) ),
 							anotherOldAttr,
 							null,
@@ -716,7 +716,7 @@ describe( 'transform', () => {
 
 				describe( 'that is more important and', () => {
 					it( 'range does not intersect original range: no operation update', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 3, 0 ] ), new Position( root, [ 4 ] ) ),
 							oldAttr,
 							null,
@@ -730,7 +730,7 @@ describe( 'transform', () => {
 					} );
 
 					it( 'range contains original range: convert to NoOperation', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1, 1, 4 ] ), new Position( root, [ 3 ] ) ),
 							oldAttr,
 							null,
@@ -748,7 +748,7 @@ describe( 'transform', () => {
 
 					// [ original range   <   ]   range transformed by >
 					it( 'range intersects on left: shrink original range', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1, 4, 2 ] ), new Position( root, [ 3 ] ) ),
 							oldAttr,
 							null,
@@ -765,7 +765,7 @@ describe( 'transform', () => {
 
 					// [  range transformed by  <   ]  original range  >
 					it( 'range intersects on right: shrink original range', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1 ] ), new Position( root, [ 2, 1 ] ) ),
 							oldAttr,
 							null,
@@ -781,7 +781,7 @@ describe( 'transform', () => {
 					} );
 
 					it( 'range is inside original range: split into two operations', () => {
-						let transformBy = new ChangeOperation(
+						let transformBy = new AttributeOperation(
 							new Range( new Position( root, [ 1, 4, 1 ] ), new Position( root, [ 2, 1 ] ) ),
 							oldAttr,
 							null,
@@ -1063,7 +1063,7 @@ describe( 'transform', () => {
 			} );
 		} );
 
-		// Some extra cases for a ChangeOperation that operates on single tree level range.
+		// Some extra cases for a AttributeOperation that operates on single tree level range.
 		// This means that the change range start and end differs only on offset value.
 		// This test suite also have some modifications to the original operation
 		// to get more test cases covered and better code coverage.
@@ -1074,7 +1074,7 @@ describe( 'transform', () => {
 
 				range = new Range( start, end );
 
-				op = new ChangeOperation( range, oldAttr, newAttr, baseVersion );
+				op = new AttributeOperation( range, oldAttr, newAttr, baseVersion );
 
 				expected.range = new Range( start.clone(), end.clone() );
 			} );
@@ -1537,9 +1537,9 @@ describe( 'transform', () => {
 			} );
 		} );
 
-		describe( 'by ChangeOperation', () => {
+		describe( 'by AttributeOperation', () => {
 			it( 'no operation update', () => {
-				let transformBy = new ChangeOperation(
+				let transformBy = new AttributeOperation(
 					new Range( sourcePosition, rangeEnd ),
 					new Attribute( 'abc', true ),
 					new Attribute( 'abc', false ),
@@ -2333,9 +2333,9 @@ describe( 'transform', () => {
 			} );
 		} );
 
-		describe( 'by ChangeOperation', () => {
+		describe( 'by AttributeOperation', () => {
 			it( 'no operation update', () => {
-				let transformBy = new ChangeOperation(
+				let transformBy = new AttributeOperation(
 					new Range(
 						new Position( root, [ 0 ] ),
 						new Position( root, [ 1 ] )