Skip to content

testing: cover accordion behavior#380

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

testing: cover accordion behavior#380
RtlZeroMemory merged 2 commits intomainfrom
feature/testing-accordion-behavior

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Apr 14, 2026

Summary

  • add renderer-integration coverage for accordion header focus entry/exit, arrow navigation, and keyboard toggles
  • fix mixed zone/non-zone Tab routing so a multi-item focus zone is treated as one Tab stop when the public contract says Tab/Shift+Tab enters and leaves the zone
  • retire the weak ui.accordion(...) wrapper-shape assertion once stronger behavior-first coverage is in place

Tests changed

  • added: accordion behavior coverage in packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • added: runtime focus-zone regression coverage in packages/core/src/runtime/__tests__/focus.zones.test.ts
  • removed: ui.accordion wrapper-shape assertion from packages/core/src/widgets/__tests__/accordion.test.ts

Implementation fixes

  • updated packages/core/src/runtime/router/zones.ts so Tab and Shift+Tab leave a multi-item focus zone instead of stepping through every item inside that zone when mixed with non-zoned focusables

Verification

  • ./node_modules/.bin/tsc -b packages/core/tsconfig.json --pretty false
  • node --test packages/core/dist/app/__tests__/widgetRenderer.integration.test.js packages/core/dist/widgets/__tests__/accordion.test.js packages/core/dist/runtime/__tests__/focus.traversal.test.js packages/core/dist/runtime/__tests__/focus.zones.test.js

Remaining explicit gaps

  • mouse interaction remains intentionally unclaimed because the accordion docs only specify keyboard behavior
  • allowMultiple expansion semantics remain primarily covered by lower-level helper tests rather than a new renderer slice

Dependency

  • targets main; no stack dependency on the other open behavior-coverage PRs

Summary by CodeRabbit

Release Notes

  • Tests

    • Added comprehensive keyboard navigation test coverage for accordion widgets, including Tab, Shift+Tab, and arrow key behavior.
    • Added focus zone routing test cases for mixed focus lists.
  • Bug Fixes

    • Enhanced focus management during keyboard navigation to properly handle transitions between accordion sections and adjacent widgets.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Warning

Rate limit exceeded

@RtlZeroMemory has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 3 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 3 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 90fda95d-70a1-405f-8e38-63afa956fce9

📥 Commits

Reviewing files that changed from the base of the PR and between 0d8cb7e and 715d675.

📒 Files selected for processing (4)
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • packages/core/src/runtime/__tests__/focus.zones.test.ts
  • packages/core/src/runtime/router/zones.ts
  • packages/core/src/widgets/__tests__/accordion.test.ts
📝 Walkthrough

Walkthrough

The changes add keyboard navigation tests for accordion widgets and enhance focus zone routing logic. A new helper function enables traversal of mixed focus lists (zones with non-zoned focusables), allowing the router to find next focusable targets while respecting zone boundaries. Integration and unit tests verify accordion keyboard behavior and zone boundary transitions.

Changes

Cohort / File(s) Summary
Accordion keyboard navigation tests
packages/core/src/app/__tests__/widgetRenderer.integration.test.ts, packages/core/src/widgets/__tests__/accordion.test.ts
Added comprehensive integration test covering Tab/Shift+Tab navigation into/out of accordions and Enter/Space keyboard activation with state updates. Removed assertion validating accordion as fragment wrapper.
Focus zones test coverage
packages/core/src/runtime/__tests__/focus.zones.test.ts
Added two test cases for routeKeyWithZones verifying Tab and Shift+Tab behavior when focus is inside a multi-item zone, ensuring routing exits the zone to adjacent non-zone focusables.
Mixed focus list traversal logic
packages/core/src/runtime/router/zones.ts
Introduced findMixedTraversalTarget helper function that iteratively locates next focusable items while skipping excluded IDs. Enhanced routeKeyWithZones to compute containing zone and attempt mixed traversal before falling back to default routing.

Sequence Diagram

sequenceDiagram
    participant User as User Input
    participant Router as Zone Router
    participant Helper as findMixedTraversalTarget
    participant Focus as Focus List
    participant Zones as Zone Lookup
    
    User->>Router: Tab pressed (in zone)
    Router->>Router: Get activeZoneId
    Router->>Zones: Find current zone
    Zones-->>Router: Zone info
    Router->>Helper: Find next target (skip zone items)
    loop Find next focusable
        Helper->>Focus: Get next item in list
        Focus-->>Helper: Candidate ID
        Helper->>Zones: Check if in excluded zone
        Zones-->>Helper: Is excluded?
    end
    Helper-->>Router: Next focusable ID
    Router->>Zones: Determine zone for new focus
    Zones-->>Router: Next zone ID
    Router-->>User: Focus moved
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Through accordion keys we hop and play,
Tab and Shift tab light the way,
Zones and focusables in harmony blend,
Mixed traversal finds the end,
Keyboard navigation, our delight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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 accordion behavior' is specific and directly related to the main changes, which focus on adding comprehensive test coverage for accordion widget behavior including keyboard navigation, focus management, and toggle functionality.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/testing-accordion-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

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d8cb7ef7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/runtime/router/zones.ts Outdated
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/runtime/router/zones.ts`:
- Around line 54-56: The formatter failures are caused by the wrapped ternary
and coalescing expressions; update the expressions that use move, startIndex,
step, total to match Biome's preferred formatting (e.g., normalize the ternary
to a single clear expression: move === "next" ? (startIndex + step) % total :
(startIndex - step + total) % total) and normalize the wrapped nullish
coalescing (??) expression on the later block to use consistent
spacing/parentheses, then run Biome/autofix (or re-run the formatter) to apply
the canonical formatting for both occurrences.
🪄 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: 2e67ebda-a12d-4487-bd9e-6b098e5d2a3b

📥 Commits

Reviewing files that changed from the base of the PR and between 9df8069 and 0d8cb7e.

📒 Files selected for processing (4)
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • packages/core/src/runtime/__tests__/focus.zones.test.ts
  • packages/core/src/runtime/router/zones.ts
  • packages/core/src/widgets/__tests__/accordion.test.ts
💤 Files with no reviewable changes (1)
  • packages/core/src/widgets/tests/accordion.test.ts

Comment thread packages/core/src/runtime/router/zones.ts Outdated
@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-accordion-behavior branch from 0d8cb7e to bdd32d0 Compare April 15, 2026 07:04
@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-accordion-behavior branch from bdd32d0 to 715d675 Compare April 15, 2026 07:19
@RtlZeroMemory RtlZeroMemory merged commit 35ebd2f into main Apr 15, 2026
23 checks passed
@RtlZeroMemory RtlZeroMemory deleted the feature/testing-accordion-behavior branch April 15, 2026 07:45
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