File tree Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Expand file tree Collapse file tree 4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ export default class InputPrompt extends Base {
100
100
*/
101
101
102
102
onKeypress ( ) {
103
- this . state = 'touched' ;
103
+ this . status = 'touched' ;
104
104
105
105
this . render ( ) ;
106
106
}
Original file line number Diff line number Diff line change 54
54
},
55
55
"devDependencies" : {
56
56
"chai" : " ^4.3.6" ,
57
+ "chai-string" : " ^1.5.0" ,
57
58
"chalk-pipe" : " ^5.1.2" ,
58
59
"cmdify" : " ^0.0.4" ,
59
60
"mocha" : " ^10.0.0" ,
Original file line number Diff line number Diff line change 1
- import { expect } from 'chai' ;
1
+ import chai , { expect } from 'chai' ;
2
+ import chaiString from 'chai-string' ;
2
3
import ReadlineStub from '../../helpers/readline.js' ;
3
4
import fixtures from '../../helpers/fixtures.js' ;
4
5
5
6
import Input from '../../../lib/prompts/input.js' ;
6
7
8
+ chai . use ( chaiString ) ;
9
+
7
10
describe ( '`input` prompt' , ( ) => {
8
11
beforeEach ( function ( ) {
9
12
this . fixture = { ...fixtures . input } ;
@@ -94,4 +97,24 @@ describe('`input` prompt', () => {
94
97
done ( ) ;
95
98
} , 200 ) ;
96
99
} ) ;
100
+
101
+ it ( 'should clear default on input' , function ( done ) {
102
+ const defaultValue = 'default-string' ;
103
+ const input = new Input (
104
+ {
105
+ ...this . fixture ,
106
+ default : defaultValue ,
107
+ } ,
108
+ this . rl
109
+ ) ;
110
+
111
+ input . run ( ) ;
112
+
113
+ this . rl . line = 'inquirer' ;
114
+ this . rl . input . emit ( 'keypress' ) ;
115
+ setTimeout ( ( ) => {
116
+ expect ( this . rl . output . __raw__ ) . to . have . entriesCount ( defaultValue , 1 ) ;
117
+ done ( ) ;
118
+ } , 200 ) ;
119
+ } ) ;
97
120
} ) ;
Original file line number Diff line number Diff line change @@ -2532,6 +2532,11 @@ caniuse-lite@^1.0.30001332:
2532
2532
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001339.tgz#f9aece4ea8156071613b27791547ba0b33f176cf"
2533
2533
integrity sha512-Es8PiVqCe+uXdms0Gu5xP5PF2bxLR7OBp3wUzUnuO7OHzhOfCyg3hdiGWVPVxhiuniOzng+hTc1u3fEQ0TlkSQ==
2534
2534
2535
+ chai-string@^1.5.0 :
2536
+ version "1.5.0"
2537
+ resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.5.0.tgz#0bdb2d8a5f1dbe90bc78ec493c1c1c180dd4d3d2"
2538
+ integrity sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==
2539
+
2535
2540
chai@^4.3.6 :
2536
2541
version "4.3.6"
2537
2542
resolved "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz"
You can’t perform that action at this time.
0 commit comments