Skip to content

testing: cover tabs behavior#376

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

testing: cover tabs behavior#376
RtlZeroMemory merged 2 commits intomainfrom
feature/testing-tabs-behavior

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Apr 14, 2026

Summary

  • add renderer-integration tabs coverage for arrow-key tab switching and visible active-content updates
  • add renderer-integration coverage for Escape returning focus from tab content to the tab bar

Families Covered

  • tabs

Tests Added, Rewritten, Removed

  • added renderer-integration coverage in packages/core/src/app/__tests__/widgetRenderer.integration.test.ts for arrow-key tab switching with visible active-content updates
  • added renderer-integration coverage in the same file for Escape returning focus from tab content to the tab bar
  • rewrote no existing tests in this PR
  • removed no tests in this PR

Implementation Bugs Fixed

  • none; the behavior-first tests passed once added

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__/tabs.test.js packages/core/dist/router/__tests__/helpers.test.js packages/core/dist/__tests__/integration/integration.file-manager.test.js

Unresolved Areas Left Explicit

  • broader navigation-family work for accordion, breadcrumb, and pagination remains separate
  • router-wrapper tabs behavior remains covered primarily by router helper suites and the file-manager integration flow rather than this direct ui.tabs slice

Dependency Note

  • none

Summary by CodeRabbit

  • Tests
    • Expanded integration tests for tab keyboard navigation: verify TAB focuses the first tab trigger and arrow keys (e.g., RIGHT) move focus between tabs.
    • Verify activating a tab invokes the change callback and only that tab’s content is rendered after re-render.
    • Added tests ensuring TAB toggles focus between the active tab trigger and its content controls, and ESC from content returns focus to the active tab trigger.

@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: c11da023-5558-438f-b74d-816f926a133e

📥 Commits

Reviewing files that changed from the base of the PR and between 78079e2 and de44b24.

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

📝 Walkthrough

Walkthrough

Added two integration tests to packages/core/src/app/__tests__/widgetRenderer.integration.test.ts that validate keyboard focus and navigation for ui.tabs: TAB then RIGHT moves focus and activates the second tab (fires onChange and renders its content); ESC from tab content returns focus to the active tab trigger.

Changes

Cohort / File(s) Summary
Tabs Keyboard Navigation Tests
packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
Added two integration tests for ui.tabs keyboard behavior: (1) TAB → RIGHT focuses second tab trigger, invokes onChange with "security", and re-renders showing second tab content; (2) within tab content, TAB toggles between trigger and content button, and ESC returns focus to the active tab trigger using getTabsTriggerId.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I hop through tests with nimble feet,
Press Tab and Right — a new trigger to meet,
A change is called, the second pane blooms,
Escape brings me back from content rooms,
I munch a carrot and tidy up the suite. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'testing: cover tabs behavior' directly and clearly summarizes the main change—adding test coverage for tabs behavior, which aligns with the PR's core objective of introducing renderer-integration tests for the tabs family.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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-tabs-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/app/__tests__/widgetRenderer.integration.test.ts (1)

1131-1176: Consider adding reverse traversal (Shift+Tab) in this focus-path test.

You already verify forward traversal and ESC return; adding one reverse-hop assertion would tighten keyboard focus coverage for tabs content/bar transitions.

♻️ Suggested addition
     renderer.routeEngineEvent(keyEvent(3 /* TAB */));
     assert.equal(renderer.getFocusedId(), "general-save");

+    renderer.routeEngineEvent(keyEvent(3 /* TAB */, ZR_MOD_SHIFT));
+    assert.equal(renderer.getFocusedId(), generalTrigger);
+
+    renderer.routeEngineEvent(keyEvent(3 /* TAB */));
+    assert.equal(renderer.getFocusedId(), "general-save");
+
     renderer.routeEngineEvent(keyEvent(1 /* ESC */));
     assert.equal(renderer.getFocusedId(), generalTrigger);

As per coding guidelines **/*.test.{ts,tsx}: “Test focus traversal by asserting focused ID movement across Tab/Shift+Tab navigation.”

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

In `@packages/core/src/app/__tests__/widgetRenderer.integration.test.ts` around
lines 1131 - 1176, Add a reverse traversal assertion to the "Escape from tabs
content returns focus to the tab bar" test: after you move focus to
"general-save" (using renderer.routeEngineEvent(keyEvent(3 /* TAB */)) and
verifying renderer.getFocusedId() === "general-save"), dispatch a Shift+Tab key
event via renderer.routeEngineEvent (use the same keyEvent helper but with the
shift modifier as used elsewhere in tests) and assert renderer.getFocusedId()
=== getTabsTriggerId("settings-tabs", 0, "general") (the generalTrigger
variable), keeping the existing forward-tab and ESC assertions intact.
🤖 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/app/__tests__/widgetRenderer.integration.test.ts`:
- Around line 1131-1176: Add a reverse traversal assertion to the "Escape from
tabs content returns focus to the tab bar" test: after you move focus to
"general-save" (using renderer.routeEngineEvent(keyEvent(3 /* TAB */)) and
verifying renderer.getFocusedId() === "general-save"), dispatch a Shift+Tab key
event via renderer.routeEngineEvent (use the same keyEvent helper but with the
shift modifier as used elsewhere in tests) and assert renderer.getFocusedId()
=== getTabsTriggerId("settings-tabs", 0, "general") (the generalTrigger
variable), keeping the existing forward-tab and ESC assertions intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5ca82c46-2bc4-4a29-a356-e0283520783a

📥 Commits

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

📒 Files selected for processing (1)
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts

@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-tabs-behavior branch 3 times, most recently from 964a121 to 78079e2 Compare April 15, 2026 07:52
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/app/__tests__/widgetRenderer.integration.test.ts (1)

1411-1457: Add a Shift+Tab reverse-traversal assertion for tabs focus flow.

This test already proves ESC recovery well. Adding one explicit Shift+Tab check (content -> trigger) would complete the focus traversal contract for this path.

Suggested test refinement
     renderer.routeEngineEvent(keyEvent(3 /* TAB */));
     assert.equal(renderer.getFocusedId(), "general-save");

+    renderer.routeEngineEvent(keyEvent(3 /* TAB */, ZR_MOD_SHIFT));
+    assert.equal(renderer.getFocusedId(), generalTrigger);
+
+    renderer.routeEngineEvent(keyEvent(3 /* TAB */));
+    assert.equal(renderer.getFocusedId(), "general-save");
+
     renderer.routeEngineEvent(keyEvent(1 /* ESC */));
     assert.equal(renderer.getFocusedId(), generalTrigger);

Based on learnings: "Test focus traversal by asserting focused ID movement across Tab/Shift+Tab navigation."

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

In `@packages/core/src/app/__tests__/widgetRenderer.integration.test.ts` around
lines 1411 - 1457, Extend the "Escape from tabs content returns focus to the tab
bar" test by adding a reverse-traversal assertion using Shift+Tab: after
focusing the content button ("general-save") (currently achieved by calling
renderer.routeEngineEvent(keyEvent(3 /* TAB */)) twice), simulate Shift+Tab (use
renderer.routeEngineEvent with the keyEvent representing Shift+Tab) and assert
that renderer.getFocusedId() returns the tab trigger id (generalTrigger from
getTabsTriggerId("settings-tabs", 0, "general")). This complements the existing
ESC check and verifies content -> trigger focus movement on reverse traversal.
🤖 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/app/__tests__/widgetRenderer.integration.test.ts`:
- Around line 1411-1457: Extend the "Escape from tabs content returns focus to
the tab bar" test by adding a reverse-traversal assertion using Shift+Tab: after
focusing the content button ("general-save") (currently achieved by calling
renderer.routeEngineEvent(keyEvent(3 /* TAB */)) twice), simulate Shift+Tab (use
renderer.routeEngineEvent with the keyEvent representing Shift+Tab) and assert
that renderer.getFocusedId() returns the tab trigger id (generalTrigger from
getTabsTriggerId("settings-tabs", 0, "general")). This complements the existing
ESC check and verifies content -> trigger focus movement on reverse traversal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09bb8f24-c8ec-42b5-87e7-e2dd2612a271

📥 Commits

Reviewing files that changed from the base of the PR and between 964a121 and 78079e2.

📒 Files selected for processing (1)
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts

@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-tabs-behavior branch from 78079e2 to de44b24 Compare April 15, 2026 08:31
@RtlZeroMemory RtlZeroMemory merged commit 20f9d87 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