diff --git a/tests/input/test_input_key_actions.py b/tests/input/test_input_key_actions.py index a387f4e90..521229ae6 100644 --- a/tests/input/test_input_key_actions.py +++ b/tests/input/test_input_key_actions.py @@ -117,4 +117,22 @@ async def test_input_right_word_from_end() -> None: assert input.cursor_position == len(input.value) +async def test_input_right_word_to_the_end() -> None: + """Using right-word to get to the end should hop the correct number of times.""" + async with InputTester().run_test() as pilot: + expected_hops: dict[str | None, int] = { + "empty": 0, + "single-word": 1, + "multi-no-punctuation": 6, + "multi-punctuation": 10, + "multi-and-hyphenated": 7, + } + for input in pilot.app.query(Input): + hops = 0 + while input.cursor_position < len(input.value): + input.action_cursor_right_word() + hops += 1 + assert hops == expected_hops[input.id] + + # TODO: more tests.