-
-
Notifications
You must be signed in to change notification settings - Fork 278
Compose box colored and further styled #865
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
Closed
Ezio-Sarthak
wants to merge
4
commits into
zulip:master
from
Ezio-Sarthak:re-enhance-compose-msg-area
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
706368d
refactor: Private and public stream prefixes added and refactored.
Ezio-Sarthak 146403d
boxes: Re Stream and topic prefixes minimised and re-structured.
Ezio-Sarthak 8b8b6f5
boxes: Private and public stream prefix markers rendered.
Ezio-Sarthak d0982ae
enhancement: boxes: Re Stream marker colors rendered.
Ezio-Sarthak 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 hidden or 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 |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
from pytest import param | ||
|
||
from zulipterminal.config.keys import keys_for_command, primary_key_for_command | ||
from zulipterminal.config.symbols import ( | ||
STREAM_MARKER_INVALID, STREAM_MARKER_PRIVATE, STREAM_MARKER_PUBLIC, | ||
) | ||
from zulipterminal.ui_tools.boxes import PanelSearchBox, WriteBox | ||
|
||
|
||
|
@@ -311,13 +314,47 @@ def test__stream_box_autocomplete(self, mocker, write_box, text, state, | |
_process_typeaheads.assert_called_once_with(matching_streams, state, | ||
matching_streams) | ||
|
||
@pytest.mark.parametrize([ | ||
'stream_name', | ||
'stream_id', | ||
'is_valid_stream', | ||
'expected_marker', | ||
'expected_color'], [ | ||
('Secret stream', 99, True, STREAM_MARKER_PRIVATE, '#ccc'), | ||
('Stream 1', 1, True, STREAM_MARKER_PUBLIC, '#b0a5fd'), | ||
('Stream 0', 0, False, STREAM_MARKER_INVALID, 'general_bar'), | ||
], ids=[ | ||
'private_stream', | ||
'public_stream', | ||
'invalid_stream_name', | ||
]) | ||
def test__set_stream_write_box_style_markers(self, write_box, stream_id, | ||
stream_name, is_valid_stream, | ||
expected_marker, stream_dict, | ||
mocker, expected_color): | ||
# FIXME: Needs refactoring? | ||
write_box.model.stream_dict = stream_dict | ||
write_box.model.is_valid_stream.return_value = is_valid_stream | ||
write_box.model.stream_id_from_name.return_value = stream_id | ||
|
||
write_box.stream_box_view(stream_id) | ||
|
||
write_box._set_stream_write_box_style(write_box, stream_name) | ||
|
||
stream_marker = (write_box.header_write_box | ||
[write_box.FOCUS_HEADER_PREFIX_STREAM]) | ||
|
||
assert stream_marker.text == expected_marker | ||
assert stream_marker.attrib[0][0] == expected_color | ||
|
||
@pytest.mark.parametrize('text, expected_text', [ | ||
('Som', 'Some general stream'), | ||
('Some gen', 'Some general stream'), | ||
]) | ||
def test__stream_box_autocomplete_with_spaces(self, mocker, write_box, | ||
widget_size, | ||
text, expected_text): | ||
write_box.model.is_valid_stream.return_value = False | ||
write_box.stream_box_view(1000) | ||
stream_focus = write_box.FOCUS_HEADER_BOX_STREAM | ||
write_box.header_write_box[stream_focus].set_edit_text(text) | ||
|
@@ -561,6 +598,27 @@ def focus_val(x: str) -> int: | |
assert (write_box.FOCUS_MESSAGE_BOX_BODY | ||
== focus_val(expected_focus_col_name)) | ||
|
||
@pytest.mark.parametrize(["msg_type", "expected_box_size"], [ | ||
('private', 1), | ||
('stream', 4), | ||
('stream_edit', 5), | ||
], ids=[ | ||
'private_message', | ||
'stream_message', | ||
'stream_edit_message_box', | ||
]) | ||
def test_write_box_header_contents(self, write_box, expected_box_size, | ||
mocker, msg_type): | ||
mocker.patch(BOXES + '.WriteBox.set_editor_mode') | ||
if msg_type == 'stream': | ||
write_box.stream_box_view(1000) | ||
elif msg_type == 'stream_edit': | ||
write_box.stream_box_edit_view(1000) | ||
else: | ||
write_box.private_box_view(None, '[email protected]') | ||
|
||
assert len(write_box.header_write_box.widget_list) == expected_box_size | ||
|
||
|
||
class TestPanelSearchBox: | ||
search_caption = "Search Results " | ||
|
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.