mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add extra unit tests for password field movement
Here we're just testing the exceptional situations.
This commit is contained in:
@@ -97,6 +97,16 @@ async def test_input_left_word_from_end() -> None:
|
|||||||
assert input.cursor_position == expected_at[input.id]
|
assert input.cursor_position == expected_at[input.id]
|
||||||
|
|
||||||
|
|
||||||
|
async def test_password_input_left_word_from_end() -> None:
|
||||||
|
"""Going left one word from the end in a password field should land at home."""
|
||||||
|
async with InputTester().run_test() as pilot:
|
||||||
|
for input in pilot.app.query(Input):
|
||||||
|
input.action_end()
|
||||||
|
input.password = True
|
||||||
|
input.action_cursor_left_word()
|
||||||
|
assert input.cursor_position == 0
|
||||||
|
|
||||||
|
|
||||||
async def test_input_right_word_from_home() -> None:
|
async def test_input_right_word_from_home() -> None:
|
||||||
"""Going right one word from the start should land correctly.."""
|
"""Going right one word from the start should land correctly.."""
|
||||||
async with InputTester().run_test() as pilot:
|
async with InputTester().run_test() as pilot:
|
||||||
@@ -112,6 +122,15 @@ async def test_input_right_word_from_home() -> None:
|
|||||||
assert input.cursor_position == expected_at[input.id]
|
assert input.cursor_position == expected_at[input.id]
|
||||||
|
|
||||||
|
|
||||||
|
async def test_password_input_right_word_from_home() -> None:
|
||||||
|
"""Going right one word from the start of a password input should go to the end."""
|
||||||
|
async with InputTester().run_test() as pilot:
|
||||||
|
for input in pilot.app.query(Input):
|
||||||
|
input.password = True
|
||||||
|
input.action_cursor_right_word()
|
||||||
|
assert input.cursor_position == len(input.value)
|
||||||
|
|
||||||
|
|
||||||
async def test_input_right_word_from_end() -> None:
|
async def test_input_right_word_from_end() -> None:
|
||||||
"""Going right one word from the end should do nothing."""
|
"""Going right one word from the end should do nothing."""
|
||||||
async with InputTester().run_test() as pilot:
|
async with InputTester().run_test() as pilot:
|
||||||
|
|||||||
Reference in New Issue
Block a user