-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable cycling to recipients when editing PM #1504
Open
zormit
wants to merge
7
commits into
zulip:main
Choose a base branch
from
zormit:774-disable-cycling-to-recipients-editing-pm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+116
−44
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4fd0a50
tests: boxes: Add baseline test for private_box_view recipient editing.
9716ccc
refactor: boxes: Detail name of update_recipients method.
Subhasish-Behera 9feb30d
refactor: boxes: Extract method _setup_common_private_compose.
4921b98
refactor: boxes: Extract method update_recipients_from_user_ids.
751db14
boxes: Disable cycling while editing a Private Message.
abab4f4
boxes/messages: Disable recpient editing when editing a private message.
9b5ca86
tests: boxes: Ensure recipient box when editing is not writeable.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
from pytest import param as case | ||
from pytest_mock import MockerFixture | ||
from urwid import Widget | ||
from urwid_readline import ReadlineEdit | ||
|
||
from zulipterminal.api_types import ( | ||
TYPING_STARTED_EXPIRY_PERIOD, | ||
|
@@ -1718,6 +1719,35 @@ def focus_val(x: str) -> int: | |
expected_focus_col_name | ||
) | ||
|
||
@pytest.mark.parametrize( | ||
"recipient_ids, expected_recipient_text", | ||
[ | ||
([], "To: "), | ||
([11], "To: Human 1 <[email protected]>"), | ||
( | ||
[11, 12], | ||
"To: Human 1 <[email protected]>, Human 2 <[email protected]>", | ||
), | ||
], | ||
) | ||
def test_private_box_recipient_editing( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I learnt that sometimes using double underscores in the test function names helps, not sure about this test name in particular. Would |
||
self, | ||
mocker: MockerFixture, | ||
write_box: WriteBox, | ||
user_dict: List[Dict[str, Any]], | ||
user_id_email_dict: Dict[int, str], | ||
recipient_ids: List[int], | ||
expected_recipient_text: str, | ||
) -> None: | ||
write_box.model.user_id_email_dict = user_id_email_dict | ||
write_box.model.user_dict = user_dict | ||
mocker.patch("urwid.connect_signal") | ||
|
||
write_box.private_box_view(recipient_user_ids=recipient_ids) | ||
|
||
assert isinstance(write_box.to_write_box, ReadlineEdit) | ||
assert write_box.to_write_box.text == expected_recipient_text | ||
|
||
@pytest.mark.parametrize("key", keys_for_command("MARKDOWN_HELP")) | ||
def test_keypress_MARKDOWN_HELP( | ||
self, write_box: WriteBox, key: str, widget_size: Callable[[Widget], urwid_Size] | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test ids could be added, I assume.