Fixed prompt sometimes not clearing.
This commit is contained in:
@@ -218,7 +218,7 @@ def test_prompt_input(terminal, stdscr, ascii):
|
||||
assert isinstance(terminal.prompt_input('hi'), six.text_type)
|
||||
|
||||
attr = Color.CYAN | curses.A_BOLD
|
||||
stdscr.addstr.assert_called_with(39, 0, 'hi'.encode('ascii'), attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, 'hi'.encode('ascii'), attr)
|
||||
assert window.nlines == 1
|
||||
assert window.ncols == 78
|
||||
|
||||
@@ -236,25 +236,26 @@ def test_prompt_y_or_n(terminal, stdscr):
|
||||
|
||||
stdscr.getch.side_effect = [ord('y'), ord('N'), terminal.ESCAPE, ord('a')]
|
||||
attr = Color.CYAN | curses.A_BOLD
|
||||
text = 'hi'.encode('ascii')
|
||||
|
||||
# Press 'y'
|
||||
assert terminal.prompt_y_or_n('hi')
|
||||
stdscr.addstr.assert_called_with(39, 0, 'hi'.encode('ascii'), attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
assert not curses.flash.called
|
||||
|
||||
# Press 'N'
|
||||
assert not terminal.prompt_y_or_n('hi')
|
||||
stdscr.addstr.assert_called_with(39, 0, 'hi'.encode('ascii'), attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
assert not curses.flash.called
|
||||
|
||||
# Press Esc
|
||||
assert not terminal.prompt_y_or_n('hi')
|
||||
stdscr.addstr.assert_called_with(39, 0, 'hi'.encode('ascii'), attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
assert not curses.flash.called
|
||||
|
||||
# Press an invalid key
|
||||
assert not terminal.prompt_y_or_n('hi')
|
||||
stdscr.addstr.assert_called_with(39, 0, 'hi'.encode('ascii'), attr)
|
||||
stdscr.subwin.addstr.assert_called_with(0, 0, text, attr)
|
||||
assert curses.flash.called
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user