Skip to content

Commit

Permalink
test case for SBoudrias#1025 rawlist stops handling arrow keys after …
Browse files Browse the repository at this point in the history
…bad input
  • Loading branch information
owings1 committed Jul 3, 2021
1 parent 44ba021 commit be94794
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/inquirer/test/specs/prompts/rawlist.js
Expand Up @@ -110,6 +110,23 @@ describe('`rawlist` prompt', () => {
this.rl.emit('line', this.rl.line);
});

it('should allow for arrow navigation after invalid input', function (done) {
this.rawlist.run().then((answer) => {
try {
expect(answer).to.equal('bar');
} catch (err) {
return done(err);
}
done();
});

this.rl.emit('line', 'blah');
this.rl.input.emit('keypress', '', { name: 'down' });
this.rl.input.emit('keypress', '', { name: 'down' });
this.rl.input.emit('keypress', '', { name: 'up' });
this.rl.emit('line', this.rl.line);
});

describe('going out of boundaries', () => {
beforeEach(function () {
this.pressKey = function (dir, times) {
Expand Down

0 comments on commit be94794

Please sign in to comment.