Skip to content

testing: cover select behavior#378

Merged
RtlZeroMemory merged 2 commits intomainfrom
feature/testing-select-behavior
Apr 15, 2026
Merged

testing: cover select behavior#378
RtlZeroMemory merged 2 commits intomainfrom
feature/testing-select-behavior

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Apr 14, 2026

Summary

  • cover the remaining documented select interaction gaps without reopening dropdown
  • add direct routing coverage only for the select edge cases that were not already covered cleanly at higher fidelity
  • add renderer-integration mouse-focus coverage and renderer focus-style coverage for focusConfig: { indicator: "none" }

Tests added, rewritten, removed

  • added packages/core/src/app/__tests__/selectRouting.test.ts for arrow-wrap boundaries and the degraded no onChange path
  • added renderer-integration coverage in packages/core/src/app/__tests__/widgetRenderer.integration.test.ts for mouse click focus followed by ArrowDown selection change
  • added renderer focus-style coverage in packages/core/src/renderer/__tests__/focusIndicators.test.ts for select with focusConfig: { indicator: "none" }
  • removed no tests

Implementation bugs fixed because valid tests exposed them

  • none; the documented behavior already matched the current implementation for this slice

Test commands run

  • ./node_modules/.bin/tsc -b packages/core/tsconfig.json --pretty false
  • node --test packages/core/dist/app/__tests__/selectRouting.test.js packages/core/dist/app/__tests__/widgetRenderer.integration.test.js packages/core/dist/app/__tests__/widgetBehavior.contracts.test.js packages/core/dist/renderer/__tests__/focusIndicators.test.js packages/core/dist/runtime/__tests__/widgetMeta.test.js packages/core/dist/widgets/__tests__/formWidgets.test.js

Remaining explicit gaps

  • stale-value fallback on keyboard advance remains unasserted because the current docs do not state the exact fallback target strongly enough
  • select still has no standalone semantic shared scenario for mouse focus; this slice keeps that at renderer-integration fidelity instead of inventing a broader scenario contract

Dependency note

  • no stack dependency

Summary by CodeRabbit

  • Tests
    • Added unit tests for select keyboard navigation covering arrow-key cycling, wrap-around behavior, and skipping disabled options.
    • Added integration tests verifying select mouse focus behavior and keyboard-driven value changes/onChange invocation.
    • Added focus-indicator tests ensuring select rendering respects "none" indicator (no focus styling).

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 65f7bc50-b76c-482f-a5c3-0096b35c36a0

📥 Commits

Reviewing files that changed from the base of the PR and between 2d42784 and 9a24da1.

📒 Files selected for processing (3)
  • packages/core/src/app/__tests__/selectRouting.test.ts
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • packages/core/src/renderer/__tests__/focusIndicators.test.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/core/src/app/tests/selectRouting.test.ts
  • packages/core/src/app/tests/widgetRenderer.integration.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/renderer/tests/focusIndicators.test.ts

📝 Walkthrough

Walkthrough

Adds three tests for the select widget: keydown routing and cycling that skips disabled options, integration mouse-click and keyboard interaction asserting focus/value/onChange behavior, and a renderer contract test for focus indicator styling when disabled.

Changes

Cohort / File(s) Summary
Select Routing Test
packages/core/src/app/__tests__/selectRouting.test.ts
New unit tests constructing synthetic key-down events to exercise routeSelectKeyDown, verifying arrow-key cycling wraps across enabled options and skips disabled entries; also tests behavior when onChange is omitted.
Widget Renderer Integration
packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
New integration test asserting mouse down/up focuses the select without changing controlled value or calling onChange, then keyboard DOWN updates value and triggers onChange, and subsequent frame renders selected text.
Renderer Focus Indicators
packages/core/src/renderer/__tests__/focusIndicators.test.ts
New renderer contract test ensuring ui.select with focusConfig: { indicator: "none" } renders the selected label without focus styling (no bold/underline).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped through options, left none behind,
Arrow keys twirled, skipping ones unkind,
A click gave focus, not a change in state,
Then down we danced to the chosen gate,
Tiny paws applaud the tests we find.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'testing: cover select behavior' clearly and directly summarizes the main objective of the pull request—adding test coverage for select widget interactions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/testing-select-behavior

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/app/__tests__/selectRouting.test.ts`:
- Around line 11-14: Reformat the helper function signatures to satisfy Biome by
converting their multiline parameter lists into single-line signatures without
the extra trailing comma; e.g. change the createSelect declaration to "function
createSelect(value: string, onChange?: (next: string) => void): SelectProps {"
and do the same for the route helper (the signature spanning lines 27-30) so
both signatures are single-line and properly placed before the return type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: db8b5ac3-04d5-44dd-b4fa-3becfb172ef2

📥 Commits

Reviewing files that changed from the base of the PR and between 9df8069 and 2d42784.

📒 Files selected for processing (3)
  • packages/core/src/app/__tests__/selectRouting.test.ts
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • packages/core/src/renderer/__tests__/focusIndicators.test.ts

Comment thread packages/core/src/app/__tests__/selectRouting.test.ts Outdated
@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-select-behavior branch from 2d42784 to 9a24da1 Compare April 15, 2026 07:04
@RtlZeroMemory RtlZeroMemory merged commit 905c90d into main Apr 15, 2026
16 checks passed
@RtlZeroMemory RtlZeroMemory deleted the feature/testing-select-behavior branch April 15, 2026 07:12
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.

1 participant