diff --git a/tests/ui_tools/test_popups.py b/tests/ui_tools/test_popups.py index 01d1630bbc..bb21429307 100644 --- a/tests/ui_tools/test_popups.py +++ b/tests/ui_tools/test_popups.py @@ -504,8 +504,17 @@ def test_keypress_exit_popup(self, key, widget_size): self.msg_info_view.keypress(size, key) assert self.controller.exit_popup.called + @pytest.mark.parametrize('key', keys_for_command('VIEW_IN_BROWSER')) + def test_keypress_view_in_browser(self, widget_size, message_fixture, key): + size = widget_size(self.msg_info_view) + + self.msg_info_view.keypress(size, key) + + (self.controller.view_in_browser. + assert_called_once_with(message_fixture['id'])) + def test_height_noreactions(self): - expected_height = 3 + expected_height = 4 assert self.msg_info_view.height == expected_height # FIXME This is the same parametrize as MessageBox:test_reactions_view @@ -553,8 +562,9 @@ def test_height_reactions(self, message_fixture, to_vary_in_each_message): self.msg_info_view = MsgInfoView(self.controller, varied_message, 'Message Information', OrderedDict(), list()) - # 9 = 3 labels + 1 blank line + 1 'Reactions' (category) + 4 reactions. - expected_height = 9 + # 10 = 4 labels + 1 blank line + 1 'Reactions' (category) + 4 + # reactions (excluding 'Message Links'). + expected_height = 10 assert self.msg_info_view.height == expected_height def test_keypress_navigation(self, mocker, widget_size, diff --git a/zulipterminal/ui_tools/views.py b/zulipterminal/ui_tools/views.py index 4c9819de44..b13c16747f 100644 --- a/zulipterminal/ui_tools/views.py +++ b/zulipterminal/ui_tools/views.py @@ -1232,7 +1232,10 @@ def __init__(self, controller: Any, msg: Message, title: str, msg_info = [ ('', [('Date & Time', date_and_time), ('Sender', msg['sender_full_name']), - ('Sender\'s Email ID', msg['sender_email'])]), + ('Sender\'s Email ID', msg['sender_email']), + ('View message in the web browser', 'Press {}'.format( + ', '.join(map(repr, keys_for_command('VIEW_IN_BROWSER'))))), + ]), ] # Only show the 'Edit History' label for edited messages. self.show_edit_history_label = ( @@ -1303,6 +1306,8 @@ def keypress(self, size: urwid_Size, key: str) -> str: message_links=self.message_links, time_mentions=self.time_mentions, ) + elif is_command_key('VIEW_IN_BROWSER', key): + self.controller.view_in_browser(self.msg['id']) return super().keypress(size, key)