Parcourir la source

Improved test style.

Maciej Bukowski il y a 7 ans
Parent
commit
fef801d663
1 fichiers modifiés avec 6 ajouts et 5 suppressions
  1. 6 5
      packages/ckeditor5-paragraph/tests/paragraphcommand.js

+ 6 - 5
packages/ckeditor5-paragraph/tests/paragraphcommand.js

@@ -82,12 +82,13 @@ describe( 'ParagraphCommand', () => {
 			setData( model, '<paragraph>[foo]</paragraph><notBlock>foo</notBlock>' );
 			const element = document.getRoot().getChild( 1 );
 
-			// Purposely not putting it in `model.change` to update command manually.
-			document.selection._setTo( Range.createIn( element ) );
+			model.change( writer => {
+				writer.setSelection( Range.createIn( element ) );
 
-			expect( command.value ).to.be.true;
-			command.refresh();
-			expect( command.value ).to.be.false;
+				expect( command.value ).to.be.true;
+				command.refresh();
+				expect( command.value ).to.be.false;
+			} );
 		} );
 	} );