Skip to content

Commit

Permalink
Merge pull request #182 from ultimatecoder/master-fix-broken-message-…
Browse files Browse the repository at this point in the history
…rendring

Fix for displaying quote based messages in conversation
  • Loading branch information
heartsucker authored Nov 21, 2018
2 parents e873606 + d5a2831 commit 043e985
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def __init__(self, text):
super().__init__()
layout = QVBoxLayout()
self.setLayout(layout)
message = QLabel(html.escape(text))
message = QLabel(html.escape(text, quote=False))
message.setWordWrap(True)
layout.addWidget(message)

Expand Down
10 changes: 10 additions & 0 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,16 @@ def test_SpeechBubble_html_init():
mock_label.assert_called_once_with('<b>hello</b>')


def test_SpeechBubble_with_apostrophe_in_text():
"""Check Speech Bubble is displaying text with apostrophe correctly."""
with mock.patch('securedrop_client.gui.widgets.QLabel') as mock_label, \
mock.patch('securedrop_client.gui.widgets.QVBoxLayout'), \
mock.patch('securedrop_client.gui.widgets.SpeechBubble.setLayout'):
message = "I'm sure, you are reading my message."
SpeechBubble(message)
mock_label.assert_called_once_with(message)


def test_ConversationWidget_init_left():
"""
Check the ConversationWidget is configured correctly for align-left.
Expand Down

0 comments on commit 043e985

Please sign in to comment.