diff --git a/securedrop_client/gui/widgets.py b/securedrop_client/gui/widgets.py index bced5295fd..c4ba32d2f3 100644 --- a/securedrop_client/gui/widgets.py +++ b/securedrop_client/gui/widgets.py @@ -1293,7 +1293,7 @@ class SpeechBubble(QWidget): """ CSS = ''' - #speech-bubble { + #speech_bubble { font-family: 'Source Sans Pro'; font-weight: 400; font-size: 15px; @@ -1303,7 +1303,7 @@ class SpeechBubble(QWidget): border-bottom: 0; background-color: #fff; } - #color-bar { + #color_bar { padding: 0px; background-color: #102781; min-height: 5px; @@ -1322,13 +1322,13 @@ def __init__(self, message_id: str, text: str, update_signal) -> None: layout.setSpacing(0) self.setLayout(layout) self.message = SecureQLabel(text) - self.message.setObjectName('speech-bubble') + self.message.setObjectName('speech_bubble') self.message.setWordWrap(True) self.message.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) layout.addWidget(self.message) self.color_bar = QWidget() - self.color_bar.setObjectName('color-bar') + self.color_bar.setObjectName('color_bar') self.color_bar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) layout.addWidget(self.color_bar) @@ -1397,11 +1397,11 @@ class ReplyWidget(ConversationWidget): """ CSS_COLOR_BAR_REPLY_FAIL = ''' - background-color: #ff3366; + background_color: #ff3366; ''' CSS_COLOR_BAR_REPLY = ''' - background-color: #0065db; + background_color: #0065db; ''' def __init__( @@ -1418,9 +1418,6 @@ def __init__( align="right") self.message_id = message_id - # Set css id - self.setObjectName('reply-widget') - # Set styles self.speech_bubble.color_bar.setStyleSheet(self.CSS_COLOR_BAR_REPLY) diff --git a/tests/gui/test_widgets.py b/tests/gui/test_widgets.py index a1bd37df24..1662a4c257 100644 --- a/tests/gui/test_widgets.py +++ b/tests/gui/test_widgets.py @@ -1101,9 +1101,12 @@ def test_SpeechBubble_init(mocker): mock_connect = mocker.Mock() mock_signal.connect = mock_connect - SpeechBubble('mock id', 'hello', mock_signal) + sb = SpeechBubble('mock id', 'hello', mock_signal) + ss = sb.styleSheet() + mock_label.assert_called_once_with('hello') assert mock_connect.called + assert 'background-color' in ss def test_SpeechBubble_update_text(mocker): @@ -1186,10 +1189,8 @@ def test_MessageWidget_init(mocker): mock_connected = mocker.Mock() mock_signal.connect = mock_connected - mw = MessageWidget('mock id', 'hello', mock_signal) - ss = mw.styleSheet() + MessageWidget('mock id', 'hello', mock_signal) - assert 'background-color' in ss assert mock_connected.called @@ -1209,16 +1210,14 @@ def test_ReplyWidget_init(mocker): mock_failure_connected = mocker.Mock() mock_failure_signal.connect = mock_failure_connected - rw = ReplyWidget( + ReplyWidget( 'mock id', 'hello', mock_update_signal, mock_success_signal, mock_failure_signal, ) - ss = rw.styleSheet() - assert 'background-color' in ss assert mock_update_connected.called assert mock_success_connected.called assert mock_failure_connected.called