Browse Source

Tests: Added missing test (thank you Istanbul!).

Piotr Jasiun 10 years ago
parent
commit
2a52bffdaf
1 changed files with 22 additions and 0 deletions
  1. 22 0
      packages/ckeditor5-utils/tests/document/moveoperation.js

+ 22 - 0
packages/ckeditor5-utils/tests/document/moveoperation.js

@@ -220,4 +220,26 @@ describe( 'MoveOperation', function() {
 			}
 		).to.throw( CKEditorError, /operation-move-node-into-itself/ );
 	} );
+
+	it( 'should not throw an error if operation move a range into a sibling', function() {
+		var p = new Element( 'p' );
+		root.insertChildren( 0, [ 'ab', p, 'xy' ] );
+
+		var operation = new MoveOperation(
+			new Position( [ 1 ], root ),
+			new Position( [ 2, 0 ], root ),
+			1,
+			doc.version
+		);
+
+		expect(
+			function() {
+				doc.applyOperation( operation );
+			}
+		).not.to.throw();
+
+		expect( root.getChildCount() ).to.equal( 4 );
+		expect( p.getChildCount() ).to.equal( 1 );
+		expect( p.getChild( 0 ).character ).to.equal( 'b' );
+	} );
 } );