aboutsummaryrefslogtreecommitdiff
path: root/app/tests/test_tui.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/tests/test_tui.py')
-rw-r--r--app/tests/test_tui.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/tests/test_tui.py b/app/tests/test_tui.py
index c836178..eb6872a 100644
--- a/app/tests/test_tui.py
+++ b/app/tests/test_tui.py
@@ -688,6 +688,30 @@ class FormTests(TuiTestCase):
self.assertIn("Value: ''", texts)
self.assert_inside_border(screen)
+ def test_choice_menu_shows_the_fields_help_lines(self):
+ # A choice field's "help" renders as dim lines inside its
+ # selection menu (like the text editor's hints).
+ fields = [
+ {"key": "fmt", "label": "Format", "kind": "choice",
+ "value": "mp3", "choices": ["mp3", "ogg"],
+ "help": ["Check the format docs for supported codecs."]},
+ {"key": "chunk", "label": "Chunk", "kind": "text",
+ "value": "250"},
+ ]
+ # Enter opens the choice menu, Esc backs out; Tab -> Save, Enter.
+ screen = FakeScreen(keys=[10, 27, 9, 10])
+ tui.form(screen, "Settings", fields)
+ texts = [text for _, _, text, _ in screen.strings]
+ self.assertIn("Check the format docs for supported codecs.", texts)
+ self.assert_inside_border(screen)
+
+ # Without the hint nothing renders it.
+ fields[0].pop("help")
+ screen = FakeScreen(keys=[10, 27, 9, 10])
+ tui.form(screen, "Settings", fields)
+ texts = [text for _, _, text, _ in screen.strings]
+ self.assertNotIn("Check the format docs for supported codecs.", texts)
+
def test_field_note_renders_and_save(self):
fields = self._fields()
fields[1]["note"] = "A short section note"