Skip to content

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Jan 11, 2026

This adds new tests to prevent regression of focus/registration bugs in text input components:

Registration tests:

  • test_search_bar_registers: verify search bar registers buffer
  • test_textfield_with_selection_registers: verify selection variant
  • test_search_view_registers: verify search modal registers query

Focus persistence tests:

  • test_search_bar_focus_persists: focus maintained across frames
  • test_unregistered_field_loses_focus: negative test for tracking
  • test_focus_switch_between_fields: multi-field focus transfer

State transition tests:

  • test_disabled_field_clears_focus: disabled clears focus
  • test_read_only_field_clears_focus: read_only clears focus
  • test_slider_unrendered_clears_active: slider state cleanup
  • test_rerender_after_skip_frame: conditional rendering behavior

Stress test:

  • test_many_textfields_stress: 32 fields to test hash collisions

Summary by cubic

Add tests for text input field tracking to prevent focus/registration regressions and verify state cleanup across frames. Expands coverage for search bar, textfield variants, search view, and slider active state.

  • Coverage
    • Registration: search bar, textfield with selection, search view query.
    • Focus: persistence across frames, unregistered cleared, switch between fields.
    • State changes: disabled/read-only clear focus, unrendered slider clears active, rerender after skip regains focus.
    • Stress: 32 textfields to exercise hash-collision handling.

Written for commit 44af8fe. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="tests/test-tracking.c">

<violation number="1" location="tests/test-tracking.c:507">
P2: The new focus-switching test bypasses the real focus logic by writing directly to ctx->focused_edit, so it cannot detect regressions in the behavior it claims to cover.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

This adds new tests to prevent regression of focus/registration bugs in
text input components:

Registration tests:
- test_search_bar_registers: verify search bar registers buffer
- test_textfield_with_selection_registers: verify selection variant
- test_search_view_registers: verify search modal registers query

Focus persistence tests:
- test_search_bar_focus_persists: focus maintained across frames
- test_unregistered_field_loses_focus: negative test for tracking
- test_focus_switch_between_fields: multi-field focus transfer via click

State transition tests:
- test_disabled_field_clears_focus: disabled clears focus
- test_read_only_field_clears_focus: read_only clears focus
- test_slider_unrendered_clears_active: slider state cleanup
- test_rerender_after_skip_frame: conditional rendering behavior

Stress test:
- test_many_textfields_stress: 32 fields to test hash collisions

These tests would have caught the bug fixed in commit 41c4b76 where
text input components failed to register with field tracking system.

All focus tests use real mouse input simulation to test actual focus
handling logic, not direct state manipulation.
@jserv jserv merged commit cec283b into main Jan 11, 2026
11 checks passed
@jserv jserv deleted the test-text-input branch January 11, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants