File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ export default class InputPrompt extends Base {
100100 */
101101
102102 onKeypress ( ) {
103- this . state = 'touched' ;
103+ this . status = 'touched' ;
104104
105105 this . render ( ) ;
106106 }
Original file line number Diff line number Diff line change 5454 },
5555 "devDependencies" : {
5656 "chai" : " ^4.3.6" ,
57+ "chai-string" : " ^1.5.0" ,
5758 "chalk-pipe" : " ^5.1.2" ,
5859 "cmdify" : " ^0.0.4" ,
5960 "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' ;
23import ReadlineStub from '../../helpers/readline.js' ;
34import fixtures from '../../helpers/fixtures.js' ;
45
56import Input from '../../../lib/prompts/input.js' ;
67
8+ chai . use ( chaiString ) ;
9+
710describe ( '`input` prompt' , ( ) => {
811 beforeEach ( function ( ) {
912 this . fixture = { ...fixtures . input } ;
@@ -94,4 +97,24 @@ describe('`input` prompt', () => {
9497 done ( ) ;
9598 } , 200 ) ;
9699 } ) ;
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+ } ) ;
97120} ) ;
Original file line number Diff line number Diff line change @@ -2532,6 +2532,11 @@ caniuse-lite@^1.0.30001332:
25322532 resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001339.tgz#f9aece4ea8156071613b27791547ba0b33f176cf"
25332533 integrity sha512-Es8PiVqCe+uXdms0Gu5xP5PF2bxLR7OBp3wUzUnuO7OHzhOfCyg3hdiGWVPVxhiuniOzng+hTc1u3fEQ0TlkSQ==
25342534
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+
25352540chai@^4.3.6 :
25362541 version "4.3.6"
25372542 resolved "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz"
You can’t perform that action at this time.
0 commit comments