Skip to content

testing: cover breadcrumb behavior#377

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

testing: cover breadcrumb behavior#377
RtlZeroMemory merged 2 commits intomainfrom
feature/testing-breadcrumb-behavior

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Apr 14, 2026

Summary

  • cover breadcrumb keyboard focus movement and activation at renderer-integration fidelity
  • fix breadcrumb keyboard traversal so Tab and Shift+Tab move across clickable crumbs as documented
  • narrow lower-level breadcrumb tests to clickable-item semantics instead of wrapper shape

Tests added, rewritten, removed

  • added renderer-integration coverage in packages/core/src/app/__tests__/widgetRenderer.integration.test.ts for Tab, Shift+Tab, and Enter on clickable breadcrumb items
  • rewrote packages/core/src/widgets/__tests__/breadcrumb.test.ts to keep deterministic clickable-item and separator coverage without pinning focusZone / fragment wrapper shape
  • removed no test files

Implementation bugs fixed because valid tests exposed them

  • packages/core/src/widgets/breadcrumb.ts no longer wraps clickable crumbs in a focusZone; the previous structure caused repeated Tab to cycle by zone traversal instead of moving crumb-by-crumb
  • packages/core/src/renderer/renderToDrawlist/widgets/navigation.ts now applies breadcrumb design-system overrides directly to child buttons after the wrapper removal

Test commands run

  • ./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__/breadcrumb.test.js packages/core/dist/router/__tests__/helpers.test.js packages/core/dist/widgets/__tests__/widgetRenderSmoke.test.js

Remaining explicit gaps

  • breadcrumb arrow-key behavior is still not documented as public contract and is left unasserted here
  • getBreadcrumbZoneId(...) remains exported even though breadcrumb no longer uses a runtime focus-zone wrapper

Dependency note

  • no stack dependency

Summary by CodeRabbit

  • Tests

    • Added an integration test verifying breadcrumb keyboard navigation (Tab / Shift+Tab) and that Enter activates only the focused item.
    • Updated unit tests to reflect the breadcrumb’s new structure and to validate custom separator rendering.
  • Refactor

    • Removed the breadcrumb focus-zone wrapper exposed to the renderer.
    • Applied navigation behavior at the individual breadcrumb-item level so items receive per-item navigation overrides.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b64fc734-c490-4356-b73a-be229d9c8d60

📥 Commits

Reviewing files that changed from the base of the PR and between 4388d4a and b5025eb.

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

📝 Walkthrough

Walkthrough

Breadcrumbs no longer render inside a top-level focusZone; they now output a frozen row of child VNodes. Navigation override logic was changed to apply navigation DS props per breadcrumb child. Tests added/updated to validate per-item IDs, focus traversal, geometry entries, and ENTER activation.

Changes

Cohort / File(s) Summary
Breadcrumb widget
packages/core/src/widgets/breadcrumb.ts, packages/core/src/widgets/__tests__/breadcrumb.test.ts
Removed top-level focusZone wrapper; buildBreadcrumbChildren returns a frozen row. Tests updated to expect row shape and per-item button vnodes with IDs from getBreadcrumbItemId and correct labels/separators.
Navigation renderer
packages/core/src/renderer/renderToDrawlist/widgets/navigation.ts
Removed getBreadcrumbZoneId branch from control-zone resolution. buildNavigationControlOverrides now special-cases vnode.kind === "breadcrumb" by iterating children and cloning individual children with navigation DS props, returning a Map of changed child instances.
Integration test
packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
Added integration test for breadcrumb keyboard behavior: asserts focus IDs, drawlist geometry entries for clickable items, TAB/Shift+TAB traversal between clickable items, and ENTER triggers the focused item's onPress once.

Sequence Diagram(s)

sequenceDiagram
    participant Builder as Breadcrumb Builder
    participant Renderer as Navigation Renderer
    participant Drawlist as Drawlist
    participant Focus as Focus/Keyboard System
    participant App as App (onPress)

    Builder->>Renderer: emit `breadcrumb` vnode (frozen `row` with children)
    Renderer->>Renderer: detect `breadcrumb` kind
    Renderer->>Renderer: iterate children, clone with navigation DS props when needed
    Renderer->>Drawlist: apply overrides and render items
    Focus->>Drawlist: TAB / Shift+TAB moves focus among rendered items
    Focus->>App: ENTER on focused clickable item
    App->>App: invoke `onPress` handler (once)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hopped the breadcrumb row tonight,
Each button shone in its own small light,
The renderer cloned a child or two,
TABs led the path, ENTER rang true,
One press, one hop — carrot-bright! 🥕

🚥 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 breadcrumb behavior' accurately describes the main change—adding comprehensive test coverage for breadcrumb keyboard behavior (Tab, Shift+Tab, Enter navigation). It directly aligns with the PR's primary objective of validating breadcrumb interaction patterns.

✏️ 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-breadcrumb-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.

🧹 Nitpick comments (1)
packages/core/src/widgets/breadcrumb.ts (1)

25-27: Consider whether getBreadcrumbZoneId needs to remain exported.

The function has dedicated test coverage for deterministic encoding behavior, suggesting it was a deliberate API contract. However, if it's no longer required by external consumers (since the breadcrumb widget auto-generates IDs internally), consider marking it @deprecated or removing it along with its tests.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/widgets/breadcrumb.ts` around lines 25 - 27, The exported
helper getBreadcrumbZoneId appears to be internal-only now; decide whether to
remove or mark deprecated: search for external usages of getBreadcrumbZoneId
(references/imports outside packages/core), if none remove the exported function
and delete its dedicated tests and any exports from index/barrel files;
otherwise add a JSDoc `@deprecated` tag to getBreadcrumbZoneId (update its
comment) and keep tests but add a note in the test describing deprecation,
ensuring callers still pass compilation and exports remain intact. Ensure you
update any type exports or re-exports (barrel files) to match the chosen
approach.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/core/src/widgets/breadcrumb.ts`:
- Around line 25-27: The exported helper getBreadcrumbZoneId appears to be
internal-only now; decide whether to remove or mark deprecated: search for
external usages of getBreadcrumbZoneId (references/imports outside
packages/core), if none remove the exported function and delete its dedicated
tests and any exports from index/barrel files; otherwise add a JSDoc `@deprecated`
tag to getBreadcrumbZoneId (update its comment) and keep tests but add a note in
the test describing deprecation, ensuring callers still pass compilation and
exports remain intact. Ensure you update any type exports or re-exports (barrel
files) to match the chosen approach.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a733375d-b010-407b-8382-bd4f221e89e8

📥 Commits

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

📒 Files selected for processing (4)
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • packages/core/src/renderer/renderToDrawlist/widgets/navigation.ts
  • packages/core/src/widgets/__tests__/breadcrumb.test.ts
  • packages/core/src/widgets/breadcrumb.ts

@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-breadcrumb-behavior branch 2 times, most recently from d048cde to 392e2b4 Compare April 15, 2026 07:19
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.

🧹 Nitpick comments (1)
packages/core/src/widgets/__tests__/breadcrumb.test.ts (1)

93-96: Rename test to match what it actually exercises.

The test title references createBreadcrumbVNode, but the body calls buildBreadcrumbChildren. Renaming avoids confusion during failures.

Suggested rename
-  test("createBreadcrumbVNode applies custom separator", () => {
+  test("buildBreadcrumbChildren applies custom separator", () => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/widgets/__tests__/breadcrumb.test.ts` around lines 93 - 96,
The test title is misleading: it says createBreadcrumbVNode but the body calls
buildBreadcrumbChildren; rename the test to match the exercised function by
changing the description string in the test declaration to something like
"buildBreadcrumbChildren applies custom separator" so the test name reflects the
function under test (look for the test(...) call containing
buildBreadcrumbChildren and update its first argument).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/core/src/widgets/__tests__/breadcrumb.test.ts`:
- Around line 93-96: The test title is misleading: it says createBreadcrumbVNode
but the body calls buildBreadcrumbChildren; rename the test to match the
exercised function by changing the description string in the test declaration to
something like "buildBreadcrumbChildren applies custom separator" so the test
name reflects the function under test (look for the test(...) call containing
buildBreadcrumbChildren and update its first argument).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8911e5bd-866f-4814-afc1-aa20ace88c44

📥 Commits

Reviewing files that changed from the base of the PR and between b2db0b0 and 392e2b4.

📒 Files selected for processing (4)
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • packages/core/src/renderer/renderToDrawlist/widgets/navigation.ts
  • packages/core/src/widgets/__tests__/breadcrumb.test.ts
  • packages/core/src/widgets/breadcrumb.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/core/src/renderer/renderToDrawlist/widgets/navigation.ts
  • packages/core/src/app/tests/widgetRenderer.integration.test.ts

@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-breadcrumb-behavior branch from 392e2b4 to bd6975a Compare April 15, 2026 08:00
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/widgets/__tests__/breadcrumb.test.ts`:
- Around line 94-96: The test currently early-returns if the row shape is wrong,
allowing false-positive passes; update the test around buildBreadcrumbChildren
and the row variable to assert row.kind === "row" (e.g., using
expect(row?.kind).toBe("row")) before the guard so the test fails fast with
clear contract evidence, then keep the existing guard only as a
TypeScript/Narrowing aid; ensure the assertion references the row variable from
buildBreadcrumbChildren and preserves subsequent checks of row.props /
row.children.
🪄 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: 0858940f-6dae-4a01-b978-66b4c5c49a29

📥 Commits

Reviewing files that changed from the base of the PR and between 392e2b4 and bd6975a.

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

Comment thread packages/core/src/widgets/__tests__/breadcrumb.test.ts
@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-breadcrumb-behavior branch from bd6975a to 4388d4a Compare April 15, 2026 08:37
@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-breadcrumb-behavior branch from 4388d4a to b5025eb Compare April 15, 2026 08:47
@RtlZeroMemory RtlZeroMemory merged commit 4278c25 into main Apr 15, 2026
34 checks passed
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