@@ -30,6 +30,7 @@ class TestSelectionManager extends SelectionManager {
3030
3131 public selectLineAt ( line : number ) : void { this . _selectLineAt ( line ) ; }
3232 public selectWordAt ( coords : [ number , number ] ) : void { this . _selectWordAt ( coords , true ) ; }
33+ public areCoordsInSelection ( coords : [ number , number ] , start : [ number , number ] , end : [ number , number ] ) : boolean { return this . _areCoordsInSelection ( coords , start , end ) ; }
3334
3435 // Disable DOM interaction
3536 public enable ( ) : void { }
@@ -478,5 +479,17 @@ describe('SelectionManager', () => {
478479 assert . equal ( selectionManager . selectionText , 'a\n😁\nc' ) ;
479480 } ) ;
480481 } ) ;
482+
483+ describe ( '_areCoordsInSelection' , ( ) => {
484+ it ( 'should return whether coords are in the selection' , ( ) => {
485+ assert . isFalse ( selectionManager . areCoordsInSelection ( [ 0 , 0 ] , [ 2 , 0 ] , [ 2 , 1 ] ) ) ;
486+ assert . isFalse ( selectionManager . areCoordsInSelection ( [ 1 , 0 ] , [ 2 , 0 ] , [ 2 , 1 ] ) ) ;
487+ assert . isTrue ( selectionManager . areCoordsInSelection ( [ 2 , 0 ] , [ 2 , 0 ] , [ 2 , 1 ] ) ) ;
488+ assert . isTrue ( selectionManager . areCoordsInSelection ( [ 10 , 0 ] , [ 2 , 0 ] , [ 2 , 1 ] ) ) ;
489+ assert . isTrue ( selectionManager . areCoordsInSelection ( [ 0 , 1 ] , [ 2 , 0 ] , [ 2 , 1 ] ) ) ;
490+ assert . isTrue ( selectionManager . areCoordsInSelection ( [ 1 , 1 ] , [ 2 , 0 ] , [ 2 , 1 ] ) ) ;
491+ assert . isFalse ( selectionManager . areCoordsInSelection ( [ 2 , 1 ] , [ 2 , 0 ] , [ 2 , 1 ] ) ) ;
492+ } ) ;
493+ } ) ;
481494} ) ;
482495
0 commit comments