Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Review writerSetSelection() API calls with single position.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Oct 29, 2018
1 parent a5d2f69 commit f430cd4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/highlightcommand.js
Expand Up @@ -130,10 +130,10 @@ describe( 'HighlightCommand', () => {

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;
Expand All @@ -152,14 +152,14 @@ describe( 'HighlightCommand', () => {
// 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.
Expand Down

0 comments on commit f430cd4

Please sign in to comment.