File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1061,6 +1061,16 @@ for (let i = 0; i < 12; i++) {
10611061 rli . close ( ) ;
10621062 }
10631063
1064+ // Calling only the first question callback
1065+ {
1066+ const [ rli ] = getInterface ( { terminal } ) ;
1067+ rli . question ( 'foo?' , common . mustCall ( ( answer ) => {
1068+ assert . strictEqual ( answer , 'bar' ) ;
1069+ } ) ) ;
1070+ rli . question ( 'hello?' , common . mustNotCall ( ) ) ;
1071+ rli . write ( 'bar\n' ) ;
1072+ }
1073+
10641074 // Calling the question multiple times
10651075 {
10661076 const [ rli ] = getInterface ( { terminal } ) ;
@@ -1329,6 +1339,26 @@ for (let i = 0; i < 12; i++) {
13291339 rli . close ( ) ;
13301340 } ) , delay ) ;
13311341 }
1342+
1343+ // Write correctly if paused
1344+ {
1345+ const [ rli ] = getInterface ( { terminal } ) ;
1346+ rli . on ( 'line' , common . mustCall ( ( line ) => {
1347+ assert . strictEqual ( line , 'bar' ) ;
1348+ } ) ) ;
1349+ rli . pause ( ) ;
1350+ rli . write ( 'bar\n' ) ;
1351+ assert . strictEqual ( rli . paused , false ) ;
1352+ rli . close ( ) ;
1353+ }
1354+
1355+ // Write undefined
1356+ {
1357+ const [ rli ] = getInterface ( { terminal } ) ;
1358+ rli . on ( 'line' , common . mustNotCall ( ) ) ;
1359+ rli . write ( ) ;
1360+ rli . close ( ) ;
1361+ }
13321362} ) ;
13331363
13341364// Ensure that the _wordLeft method works even for large input
You can’t perform that action at this time.
0 commit comments