File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1101,6 +1101,23 @@ def test_keypress_goback(self, key):
1101
1101
self .help_view .keypress (size , key )
1102
1102
assert self .controller .exit_popup .called
1103
1103
1104
+ @pytest .mark .parametrize ('key, expected_key' , [
1105
+ (key , expected_key )
1106
+ for keys , expected_key in [
1107
+ (keys_for_command ('GO_UP' ), 'up' ),
1108
+ (keys_for_command ('GO_DOWN' ), 'down' ),
1109
+ (keys_for_command ('SCROLL_UP' ), 'page up' ),
1110
+ (keys_for_command ('SCROLL_DOWN' ), 'page down' ),
1111
+ (keys_for_command ('GO_TO_BOTTOM' ), 'end' ),
1112
+ ]
1113
+ for key in keys
1114
+ ])
1115
+ def test_keypress_navigation (self , mocker , key , expected_key ):
1116
+ size = (200 , 20 )
1117
+ super_view = mocker .patch (VIEWS + '.urwid.ListBox.keypress' )
1118
+ self .help_view .keypress (size , key )
1119
+ super_view .assert_called_once_with (size , expected_key )
1120
+
1104
1121
1105
1122
class TestPopUpConfirmationView :
1106
1123
@pytest .fixture
Original file line number Diff line number Diff line change @@ -792,6 +792,16 @@ def __init__(self, controller: Any) -> None:
792
792
def keypress (self , size : urwid_Size , key : str ) -> str :
793
793
if is_command_key ('GO_BACK' , key ) or is_command_key ('HELP' , key ):
794
794
self .controller .exit_popup ()
795
+ elif is_command_key ('GO_UP' , key ):
796
+ key = 'up'
797
+ elif is_command_key ('GO_DOWN' , key ):
798
+ key = 'down'
799
+ elif is_command_key ('SCROLL_UP' , key ):
800
+ key = 'page up'
801
+ elif is_command_key ('SCROLL_DOWN' , key ):
802
+ key = 'page down'
803
+ elif is_command_key ('GO_TO_BOTTOM' , key ):
804
+ key = 'end'
795
805
return super ().keypress (size , key )
796
806
797
807
You can’t perform that action at this time.
0 commit comments