diff options
| author | historia <historiavg@proton.me> | 2026-08-26 20:43:05 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-26 20:43:05 -0400 |
| commit | 65c6f737f1545ef225768af897acd20f163a4fb4 (patch) | |
| tree | 9c0974944191e50b9caa90591dfcb7f97c659770 /app/tests/test_tui.py | |
| parent | 975bd960fd07e75799b8e3adc4c0033046b34792 (diff) | |
| download | tts-audiobook-generator-65c6f737f1545ef225768af897acd20f163a4fb4.tar.gz | |
fix: settings menu only prompts to save after change
Diffstat (limited to 'app/tests/test_tui.py')
| -rw-r--r-- | app/tests/test_tui.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/tests/test_tui.py b/app/tests/test_tui.py index cd4e535..c836178 100644 --- a/app/tests/test_tui.py +++ b/app/tests/test_tui.py @@ -662,6 +662,32 @@ class FormTests(TuiTestCase): if "Voice of base" in text] self.assertTrue(titles) + def test_help_lines_render_inside_the_edit_dialog(self): + # A field's optional "help" list appears as dim lines in its line + # editor (and callables resolve against the field list). + fields = [ + {"key": "opt", "kind": "text", "value": "", + "label": "Options", + "help": lambda fs: ["First hint.", f"Value: {fs[0]['value']!r}"]}, + {"key": "plain", "label": "Plain", "kind": "text", + "value": "", "help": ["Static hint."]}, + ] + # Down to the second field, Enter opens it, Esc backs out; Tab -> + # Save, Enter. The first field's editor is never opened, so only + # the static second field's hints must appear. + screen = FakeScreen(keys=[FakeCurses.KEY_DOWN, 10, 27, 9, 10]) + tui.form(screen, "Settings", fields) + texts = [text for _, _, text, _ in screen.strings] + self.assertIn("Static hint.", texts) + self.assertNotIn("First hint.", texts) + # Open the first field's editor: dynamic help resolves per redraw. + screen = FakeScreen(keys=[10, 27, 9, 10]) + tui.form(screen, "Settings", fields) + texts = [text for _, _, text, _ in screen.strings] + self.assertIn("First hint.", texts) + self.assertIn("Value: ''", texts) + self.assert_inside_border(screen) + def test_field_note_renders_and_save(self): fields = self._fields() fields[1]["note"] = "A short section note" |
