瀏覽代碼

Fixed: RenameOperation x RenameOperation transformation.

Szymon Cofalik 9 年之前
父節點
當前提交
0163670ebd

+ 6 - 2
packages/ckeditor5-engine/src/model/operation/transform.js

@@ -244,8 +244,12 @@ const ot = {
 			// Clone the operation, we don't want to alter the original operation.
 			const clone = a.clone();
 
-			if ( a.position.isEqual( b.position ) && !isStrong ) {
-				return [ new NoOperation( a.baseVersion ) ];
+			if ( a.position.isEqual( b.position ) ) {
+				if ( isStrong ) {
+					clone.oldName = b.newName;
+				} else {
+					return [ new NoOperation( a.baseVersion ) ];
+				}
 			}
 
 			return [ clone ];

+ 3 - 1
packages/ckeditor5-engine/tests/model/operation/transform.js

@@ -2936,7 +2936,7 @@ describe( 'transform', () => {
 				} );
 			} );
 
-			it( 'same element and is not important: no change', () => {
+			it( 'same element and is not important: change old name to new name', () => {
 				let transformBy = new RenameOperation(
 					new Position( root, [ 0, 2, 2 ] ),
 					'oldName',
@@ -2947,6 +2947,8 @@ describe( 'transform', () => {
 				let transOp = transform( op, transformBy, true );
 
 				expect( transOp.length ).to.equal( 1 );
+
+				expected.oldName = 'otherName';
 				expectOperation( transOp[ 0 ], expected );
 			} );
 		} );