Parcourir la source

Aligned code to new `Writer#setSelection` API.

Maciej Bukowski il y a 7 ans
Parent
commit
37b8d68056

+ 12 - 12
packages/ckeditor5-list/tests/indentcommand.js

@@ -53,7 +53,7 @@ describe( 'IndentCommand', () => {
 		describe( 'isEnabled', () => {
 			it( 'should be true if selection starts in list item', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 5 ) );
+					writer.setSelection( root.getChild( 5 ), 0 );
 				} );
 
 				expect( command.isEnabled ).to.be.true;
@@ -61,7 +61,7 @@ describe( 'IndentCommand', () => {
 
 			it( 'should be false if selection starts in first list item', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 0 ) );
+					writer.setSelection( root.getChild( 0 ), 0 );
 				} );
 
 				expect( command.isEnabled ).to.be.false;
@@ -107,7 +107,7 @@ describe( 'IndentCommand', () => {
 
 			it( 'should be false if selection starts in a list item that has bigger indent than it\'s previous sibling', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 2 ) );
+					writer.setSelection( root.getChild( 2 ), 0 );
 				} );
 
 				expect( command.isEnabled ).to.be.false;
@@ -127,7 +127,7 @@ describe( 'IndentCommand', () => {
 		describe( 'execute()', () => {
 			it( 'should use parent batch', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 5 ) );
+					writer.setSelection( root.getChild( 5 ), 0 );
 				} );
 
 				model.change( writer => {
@@ -141,7 +141,7 @@ describe( 'IndentCommand', () => {
 
 			it( 'should increment indent attribute by 1', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 5 ) );
+					writer.setSelection( root.getChild( 5 ), 0 );
 				} );
 
 				command.execute();
@@ -159,7 +159,7 @@ describe( 'IndentCommand', () => {
 
 			it( 'should increment indent of all sub-items of indented item', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 1 ) );
+					writer.setSelection( root.getChild( 1 ), 0 );
 				} );
 
 				command.execute();
@@ -212,7 +212,7 @@ describe( 'IndentCommand', () => {
 		describe( 'isEnabled', () => {
 			it( 'should be true if selection starts in list item', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 5 ) );
+					writer.setSelection( root.getChild( 5 ), 0 );
 				} );
 
 				expect( command.isEnabled ).to.be.true;
@@ -221,7 +221,7 @@ describe( 'IndentCommand', () => {
 			it( 'should be true if selection starts in first list item', () => {
 				// This is in contrary to forward indent command.
 				model.change( writer => {
-					writer.setSelection( root.getChild( 0 ) );
+					writer.setSelection( root.getChild( 0 ), 0 );
 				} );
 
 				expect( command.isEnabled ).to.be.true;
@@ -230,7 +230,7 @@ describe( 'IndentCommand', () => {
 			it( 'should be true if selection starts in a list item that has bigger indent than it\'s previous sibling', () => {
 				// This is in contrary to forward indent command.
 				model.change( writer => {
-					writer.setSelection( root.getChild( 2 ) );
+					writer.setSelection( root.getChild( 2 ), 0 );
 				} );
 
 				expect( command.isEnabled ).to.be.true;
@@ -240,7 +240,7 @@ describe( 'IndentCommand', () => {
 		describe( 'execute()', () => {
 			it( 'should decrement indent attribute by 1 (if it is bigger than 0)', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 5 ) );
+					writer.setSelection( root.getChild( 5 ), 0 );
 				} );
 
 				command.execute();
@@ -258,7 +258,7 @@ describe( 'IndentCommand', () => {
 
 			it( 'should rename listItem to paragraph (if indent is equal to 0)', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 0 ) );
+					writer.setSelection( root.getChild( 0 ), 0 );
 				} );
 
 				command.execute();
@@ -276,7 +276,7 @@ describe( 'IndentCommand', () => {
 
 			it( 'should decrement indent of all sub-items of outdented item', () => {
 				model.change( writer => {
-					writer.setSelection( root.getChild( 1 ) );
+					writer.setSelection( root.getChild( 1 ), 0 );
 				} );
 
 				command.execute();

+ 4 - 4
packages/ckeditor5-list/tests/listcommand.js

@@ -51,7 +51,7 @@ describe( 'ListCommand', () => {
 		);
 
 		model.change( writer => {
-			writer.setSelection( doc.getRoot().getChild( 0 ) );
+			writer.setSelection( doc.getRoot().getChild( 0 ), 0 );
 		} );
 	} );
 
@@ -73,7 +73,7 @@ describe( 'ListCommand', () => {
 		describe( 'value', () => {
 			it( 'should be false if first position in selection is not in a list item', () => {
 				model.change( writer => {
-					writer.setSelection( doc.getRoot().getChild( 3 ) );
+					writer.setSelection( doc.getRoot().getChild( 3 ), 0 );
 				} );
 
 				expect( command.value ).to.be.false;
@@ -81,7 +81,7 @@ describe( 'ListCommand', () => {
 
 			it( 'should be false if first position in selection is in a list item of different type', () => {
 				model.change( writer => {
-					writer.setSelection( doc.getRoot().getChild( 2 ) );
+					writer.setSelection( doc.getRoot().getChild( 2 ), 0 );
 				} );
 
 				expect( command.value ).to.be.false;
@@ -89,7 +89,7 @@ describe( 'ListCommand', () => {
 
 			it( 'should be true if first position in selection is in a list item of same type', () => {
 				model.change( writer => {
-					writer.setSelection( doc.getRoot().getChild( 1 ) );
+					writer.setSelection( doc.getRoot().getChild( 1 ), 0 );
 				} );
 
 				expect( command.value ).to.be.true;