b588de18d6
Rebases the TUI prompt symbol fix onto the latest master, resolving conflicts with the TextArea→Input refactor and the dollar-prefix shell mode addition. Adds the missing CHANGELOG.md entry for #6431 and removes the now-obsolete tui_prompt_textarea feature/steps that tested the old TextArea-based implementation. ISSUES CLOSED: #6431
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""Behave steps for TUI prompt symbol handling."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from behave import given, then, when
|
|
from behave.runner import Context
|
|
|
|
from cleveragents.tui.widgets.prompt import PromptInput
|
|
|
|
|
|
@given("a TUI prompt widget")
|
|
def step_create_prompt(context: Context) -> None:
|
|
context.tui_prompt = PromptInput(
|
|
placeholder="Type message, /command, or !shell ..."
|
|
)
|
|
|
|
|
|
@when('I set the TUI prompt value to "{value}"')
|
|
def step_set_prompt_value(context: Context, value: str) -> None:
|
|
context.tui_prompt.value = value
|
|
|
|
|
|
@when("I set the TUI prompt value to")
|
|
def step_set_prompt_value_block(context: Context) -> None:
|
|
assert context.text is not None
|
|
context.tui_prompt.value = context.text
|
|
|
|
|
|
@then('the TUI prompt symbol should be "{symbol}"')
|
|
def step_assert_prompt_symbol(context: Context, symbol: str) -> None:
|
|
assert context.tui_prompt.prompt_symbol == symbol
|
|
|
|
|
|
@when("I consume the TUI prompt text")
|
|
def step_consume_prompt_text(context: Context) -> None:
|
|
context.tui_consumed_prompt = context.tui_prompt.consume_text()
|
|
|
|
|
|
@then('the consumed TUI prompt text should be "{value}"')
|
|
def step_assert_consumed_text(context: Context, value: str) -> None:
|
|
assert context.tui_consumed_prompt.text == value
|