Skip to content

Commit 9d6a7db

Browse files
authored
test(checkbox): increase coverage (#1258)
* test(checkbox): increase coverage * submit * cover * change * fix * fix test * fix test * fix test
1 parent 177e359 commit 9d6a7db

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

packages/checkbox/checkbox.test.mts

+50-2
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,55 @@ describe('checkbox prompt', () => {
400400
await expect(answer).resolves.not.toContain(unselect);
401401
});
402402

403-
it('allow disabling help tip', async () => {});
403+
it('allow disabling help tip', async () => {
404+
const { answer, events, getScreen } = await render(checkbox, {
405+
message: 'Select a number',
406+
choices: numberedChoices,
407+
instructions: false,
408+
});
409+
410+
expect(getScreen()).toMatchInlineSnapshot(`
411+
"? Select a number
412+
❯◯ 1
413+
◯ 2
414+
◯ 3
415+
◯ 4
416+
◯ 5
417+
◯ 6
418+
◯ 7
419+
(Move up and down to reveal more choices)"
420+
`);
421+
422+
events.keypress('enter');
423+
expect(getScreen()).toMatchInlineSnapshot('"? Select a number"');
424+
425+
await expect(answer).resolves.toEqual([]);
426+
});
404427

405-
it('allow customizing help tip', async () => {});
428+
it('allow customizing help tip', async () => {
429+
const { answer, events, getScreen } = await render(checkbox, {
430+
message: 'Select a number',
431+
choices: numberedChoices,
432+
instructions:
433+
' (Pulse <space> para seleccionar, <a> para alternar todos, <i> para invertir selección, y <enter> para continuar)',
434+
});
435+
436+
expect(getScreen()).toMatchInlineSnapshot(`
437+
"? Select a number (Pulse <space> para seleccionar, <a> para alternar todos, <i>
438+
para invertir selección, y <enter> para continuar)
439+
❯◯ 1
440+
◯ 2
441+
◯ 3
442+
◯ 4
443+
◯ 5
444+
◯ 6
445+
◯ 7
446+
(Move up and down to reveal more choices)"
447+
`);
448+
449+
events.keypress('enter');
450+
expect(getScreen()).toMatchInlineSnapshot('"? Select a number"');
451+
452+
await expect(answer).resolves.toEqual([]);
453+
});
406454
});

0 commit comments

Comments
 (0)