mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add extra unit tests for password field deletion
Here we're just testing the exceptional situations.
This commit is contained in:
@@ -66,6 +66,17 @@ async def test_delete_left_word_from_end() -> None:
|
|||||||
assert input.value == expected[input.id]
|
assert input.value == expected[input.id]
|
||||||
|
|
||||||
|
|
||||||
|
async def test_password_delete_left_word_from_end() -> None:
|
||||||
|
"""Deleting word left from end of a password input should delete everything."""
|
||||||
|
async with InputTester().run_test() as pilot:
|
||||||
|
for input in pilot.app.query(Input):
|
||||||
|
input.action_end()
|
||||||
|
input.password = True
|
||||||
|
input.action_delete_left_word()
|
||||||
|
assert input.cursor_position == 0
|
||||||
|
assert input.value == ""
|
||||||
|
|
||||||
|
|
||||||
async def test_delete_left_all_from_home() -> None:
|
async def test_delete_left_all_from_home() -> None:
|
||||||
"""Deleting all left from home should do nothing."""
|
"""Deleting all left from home should do nothing."""
|
||||||
async with InputTester().run_test() as pilot:
|
async with InputTester().run_test() as pilot:
|
||||||
@@ -119,6 +130,16 @@ async def test_delete_right_word_from_home() -> None:
|
|||||||
assert input.value == expected[input.id]
|
assert input.value == expected[input.id]
|
||||||
|
|
||||||
|
|
||||||
|
async def test_password_delete_right_word_from_home() -> None:
|
||||||
|
"""Deleting word right from home of a password input should delete everything."""
|
||||||
|
async with InputTester().run_test() as pilot:
|
||||||
|
for input in pilot.app.query(Input):
|
||||||
|
input.password = True
|
||||||
|
input.action_delete_right_word()
|
||||||
|
assert input.cursor_position == 0
|
||||||
|
assert input.value == ""
|
||||||
|
|
||||||
|
|
||||||
async def test_delete_right_word_from_end() -> None:
|
async def test_delete_right_word_from_end() -> None:
|
||||||
"""Deleting word right from end should not change the input's value."""
|
"""Deleting word right from end should not change the input's value."""
|
||||||
async with InputTester().run_test() as pilot:
|
async with InputTester().run_test() as pilot:
|
||||||
|
|||||||
Reference in New Issue
Block a user