浏览代码

Review writerSetSelection() API calls with single position.

Maciej Gołaszewski 7 年之前
父节点
当前提交
0bb1639cd7
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      packages/ckeditor5-font/tests/fontcommand.js

+ 4 - 4
packages/ckeditor5-font/tests/fontcommand.js

@@ -170,10 +170,10 @@ describe( 'FontCommand', () => {
 
 			model.change( writer => {
 				// Simulate clicking right arrow key by changing selection ranges.
-				writer.setSelection( [ writer.createRange( writer.createPositionAt( root.getNodeByPath( [ 0 ] ), 2 ) ) ] );
+				writer.setSelection( root.getNodeByPath( [ 0 ] ), 2 );
 
 				// Get back to previous selection.
-				writer.setSelection( [ writer.createRange( writer.createPositionAt( root.getNodeByPath( [ 0 ] ), 1 ) ) ] );
+				writer.setSelection( root.getNodeByPath( [ 0 ] ), 1 );
 			} );
 
 			expect( command.value ).to.be.undefined;
@@ -192,14 +192,14 @@ describe( 'FontCommand', () => {
 			// Attribute should be stored.
 			// Simulate clicking somewhere else in the editor.
 			model.change( writer => {
-				writer.setSelection( [ writer.createRange( writer.createPositionAt( root.getNodeByPath( [ 0 ] ), 2 ) ) ] );
+				writer.setSelection( root.getNodeByPath( [ 0 ] ), 2 );
 			} );
 
 			expect( command.value ).to.be.undefined;
 
 			// Go back to where attribute was stored.
 			model.change( writer => {
-				writer.setSelection( [ writer.createRange( writer.createPositionAt( root.getNodeByPath( [ 1 ] ), 0 ) ) ] );
+				writer.setSelection( root.getNodeByPath( [ 1 ] ), 0 );
 			} );
 
 			// Attribute should be restored.