Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more unit testing for the Input widget #2737

Merged
merged 11 commits into from
Jun 6, 2023

Conversation

davep
Copy link
Contributor

@davep davep commented Jun 5, 2023

Adding more unit tests for the Input widget, trying to cover as much code as possible.

This gets the Input testing as close to 100% coverage as possible. get_content_height isn't being used here (and really I'm not sure what sort of testing -- short of just calling it and seeing it it's equal to 1 -- would be sensible here) and there's handling of bindings in _on_key that is never done, even if a bound key is pressed.

On the latter point see #2742 -- I'm pretty sure that that code can be removed (I strongly suspect it's a hangover from before some changes were made last year to how bindings are processed).

I'll nuke that bit of code once these tests are in.

@davep davep added the enhancement New feature or request label Jun 5, 2023
@davep davep self-assigned this Jun 5, 2023
@davep davep marked this pull request as ready for review June 6, 2023 08:40
tests/input/test_input_mouse.py Outdated Show resolved Hide resolved
tests/input/test_input_properties.py Outdated Show resolved Hide resolved
@davep davep merged commit b252459 into Textualize:main Jun 6, 2023
@davep davep deleted the extend-input-widget-tests branch June 6, 2023 09:30
davep added a commit to davep/textual that referenced this pull request Jun 6, 2023
The branch being removed here seems to be trying to handle keyboard bindings
before handling the raw keyboard event. However, in the unit tests, even
when a binding is pressed, this code doesn't get called.

I strongly suspect this is code that predates changes that were made some
time ago in respect to the order in which bindings were processed and their
relationship to keystrokes.

After removing this all tests are passing just fine and hand-testing
`Input` (especially in the demo, for example, both non-password and password
incarnations) shows no problems either.

All evidence suggests that Textualize#2737 was incapable of hitting that branch of
code because it just could not be hit these days.
@davep davep mentioned this pull request Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants