Browse Source

Tests: corrected selection misaligned with inserted text.

Krzysztof Krztoń 8 years ago
parent
commit
af9e659739
1 changed files with 11 additions and 6 deletions
  1. 11 6
      packages/ckeditor5-typing/tests/input.js

+ 11 - 6
packages/ckeditor5-typing/tests/input.js

@@ -273,7 +273,7 @@ describe( 'Input feature', () => {
 		it( 'should replace first   with space', () => {
 			model.enqueueChanges( () => {
 				model.selection.setRanges( [
-					ModelRange.createFromParentsAndOffsets( modelRoot.getChild( 0 ), 6, modelRoot.getChild( 0 ), 6 )
+					ModelRange.createFromParentsAndOffsets( modelRoot.getChild( 0 ), 0, modelRoot.getChild( 0 ), 0 )
 				] );
 			} );
 
@@ -286,11 +286,17 @@ describe( 'Input feature', () => {
 				}
 			] );
 
-			expect( getModelData( model ) ).to.equal( '<paragraph> foobar[]</paragraph>' );
-			expect( getViewData( view ) ).to.equal( '<p> foobar{}</p>' );
+			expect( getModelData( model ) ).to.equal( '<paragraph> []foobar</paragraph>' );
+			expect( getViewData( view ) ).to.equal( '<p> {}foobar</p>' );
 		} );
 
 		it( 'should replace all &nbsp; with spaces', () => {
+			model.enqueueChanges( () => {
+				model.selection.setRanges( [
+					ModelRange.createFromParentsAndOffsets( modelRoot.getChild( 0 ), 6, modelRoot.getChild( 0 ), 6 )
+				] );
+			} );
+
 			view.fire( 'mutations', [
 				{
 					type: 'text',
@@ -300,9 +306,8 @@ describe( 'Input feature', () => {
 				}
 			] );
 
-			expect( getModelData( model ) ).to.equal( '<paragraph>foo[]bar   baz</paragraph>' );
-			expect( getViewData( view ) ).to.equal( '<p>foo{}bar' +
-				'   baz</p>' );
+			expect( getModelData( model ) ).to.equal( '<paragraph>foobar   baz[]</paragraph>' );
+			expect( getViewData( view ) ).to.equal( '<p>foobar   baz{}</p>' );
 		} );
 	} );