Hide back/forward widget when there's no text

This commit is contained in:
Florian Bruhin 2017-07-10 07:59:56 +02:00
parent 0e8175b8eb
commit 5fb6cb713b
2 changed files with 3 additions and 0 deletions

View File

@ -39,3 +39,4 @@ class Backforward(textbase.TextBase):
if text:
text = '[' + text + ']'
self.setText(text)
self.setVisible(bool(text))

View File

@ -47,6 +47,7 @@ def test_backforward_widget(backforward_widget, stubs,
tabbed_browser.tabs = [tab]
backforward_widget.on_tab_cur_url_changed(tabbed_browser)
assert backforward_widget.text() == expected_text
assert backforward_widget.isVisible() == bool(expected_text)
# Check that the widget gets reset if empty.
if can_go_back and can_go_forward:
@ -54,3 +55,4 @@ def test_backforward_widget(backforward_widget, stubs,
tabbed_browser.tabs = [tab]
backforward_widget.on_tab_cur_url_changed(tabbed_browser)
assert backforward_widget.text() == ''
assert not backforward_widget.isVisible()