Add a test for going left a word from the end

This commit is contained in:
Dave Pearson
2023-01-29 11:29:07 +00:00
parent 938a3b4ed5
commit fad87c90f3

View File

@@ -77,4 +77,20 @@ async def test_input_left_word_from_home() -> None:
assert input.cursor_position == 0
async def test_input_left_word_from_end() -> None:
"""Going left one word from the end should land correctly.."""
async with InputTester().run_test() as pilot:
expected_at: dict[str | None, int] = {
"empty": 0,
"single-word": 0,
"multi-no-punctuation": 33,
"multi-punctuation": 47,
"multi-and-hyphenated": 26,
}
for input in pilot.app.query(Input):
input.action_end()
input.action_cursor_left_word()
assert input.cursor_position == expected_at[input.id]
# TODO: more tests.