@@ -1493,6 +1493,35 @@ describe('paredit', () => {
1493
1493
} ) ;
1494
1494
} ) ;
1495
1495
1496
+ describe ( 'currentSexpsRange' , ( ) => {
1497
+ const docSelectionCursorPosition = ( positionNotation : string , rangeNotation : string ) => {
1498
+ const positionDoc = docFromTextNotation ( positionNotation ) ;
1499
+ const rangeDoc = docFromTextNotation ( rangeNotation ) ;
1500
+ const [ _text1 , positionSelection ] = textAndSelection ( positionDoc ) ;
1501
+ const position = positionSelection [ 0 ] ;
1502
+ const [ _text2 , selection ] = textAndSelection ( rangeDoc ) ;
1503
+ const cursor = positionDoc . getTokenCursor ( position ) ;
1504
+ return { doc : positionDoc , selection : selection , cursor, position } ;
1505
+ } ;
1506
+
1507
+ it ( 'Finds range with cursor between ignore marker and form, separated by whitespace before' , ( ) => {
1508
+ const { doc, selection, cursor, position } = docSelectionCursorPosition (
1509
+ '#_ |(:a b)' ,
1510
+ '#_ |(:a b)|'
1511
+ ) ;
1512
+ const range = paredit . currentSexpsRange ( doc , cursor , position , false ) ;
1513
+ expect ( range ) . toStrictEqual ( selection ) ;
1514
+ } ) ;
1515
+ it ( 'Finds range with cursor between ignore marker and form, no whitespace' , ( ) => {
1516
+ const { doc, selection, cursor, position } = docSelectionCursorPosition (
1517
+ '#_|(:a b)' ,
1518
+ '#_|(:a b)|'
1519
+ ) ;
1520
+ const range = paredit . currentSexpsRange ( doc , cursor , position , false ) ;
1521
+ expect ( range ) . toStrictEqual ( selection ) ;
1522
+ } ) ;
1523
+ } ) ;
1524
+
1496
1525
describe ( 'backwardUp - one line' , ( ) => {
1497
1526
it ( 'Drags up from start of vector' , async ( ) => {
1498
1527
const b = docFromTextNotation ( `(def foo [:|foo :bar :baz])` ) ;
0 commit comments