File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,11 @@ class RawListPrompt extends Base {
73
73
validation . success . forEach ( this . onEnd . bind ( this ) ) ;
74
74
validation . error . forEach ( this . onError . bind ( this ) ) ;
75
75
76
- events . normalizedUpKey . pipe ( takeUntil ( events . line ) ) . forEach ( this . onUpKey . bind ( this ) ) ;
76
+ events . normalizedUpKey
77
+ . pipe ( takeUntil ( validation . success ) )
78
+ . forEach ( this . onUpKey . bind ( this ) ) ;
77
79
events . normalizedDownKey
78
- . pipe ( takeUntil ( events . line ) )
80
+ . pipe ( takeUntil ( validation . success ) )
79
81
. forEach ( this . onDownKey . bind ( this ) ) ;
80
82
events . keypress
81
83
. pipe ( takeUntil ( validation . success ) )
Original file line number Diff line number Diff line change @@ -110,6 +110,22 @@ describe('`rawlist` prompt', () => {
110
110
this . rl . emit ( 'line' , this . rl . line ) ;
111
111
} ) ;
112
112
113
+ it ( 'should allow for arrow navigation after invalid input' , function ( done ) {
114
+ this . rawlist
115
+ . run ( )
116
+ . then ( ( answer ) => {
117
+ expect ( answer ) . to . equal ( 'bar' ) ;
118
+ done ( ) ;
119
+ } )
120
+ . catch ( done ) ;
121
+
122
+ this . rl . emit ( 'line' , 'blah' ) ;
123
+ this . rl . input . emit ( 'keypress' , '' , { name : 'down' } ) ;
124
+ this . rl . input . emit ( 'keypress' , '' , { name : 'down' } ) ;
125
+ this . rl . input . emit ( 'keypress' , '' , { name : 'up' } ) ;
126
+ this . rl . emit ( 'line' , this . rl . line ) ;
127
+ } ) ;
128
+
113
129
describe ( 'going out of boundaries' , ( ) => {
114
130
beforeEach ( function ( ) {
115
131
this . pressKey = function ( dir , times ) {
You can’t perform that action at this time.
0 commit comments