Skip to content

testing: cover pagination behavior#381

Open
RtlZeroMemory wants to merge 1 commit intomainfrom
feature/testing-pagination-behavior
Open

testing: cover pagination behavior#381
RtlZeroMemory wants to merge 1 commit intomainfrom
feature/testing-pagination-behavior

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Apr 14, 2026

Summary

  • add renderer-integration coverage for pagination Tab / Shift+Tab traversal, Left / Right page changes, and Home / End jumps
  • keep the slice behavior-first by asserting focus movement and controlled onChange effects instead of wrapper shape
  • retire the weak ui.pagination(...) wrapper-shape assertion once stronger behavior coverage is in place

Tests changed

  • added: pagination behavior coverage in packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • removed: ui.pagination wrapper-shape assertion from packages/core/src/widgets/__tests__/pagination.test.ts

Implementation fixes

  • none

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__/pagination.test.js packages/core/dist/runtime/__tests__/focus.traversal.test.js

Remaining explicit gaps

  • mouse interaction remains intentionally unclaimed because the pagination docs only specify keyboard behavior
  • visible text assertions remain limited by the current renderer text harness for this widget family, so the slice relies on focus movement and controlled callback effects

Dependency

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

Summary by CodeRabbit

  • Tests
    • Added comprehensive pagination keyboard navigation tests covering focus traversal and arrow/Home/End key behaviors.
    • Removed redundant pagination vnode test.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

Test coverage expansion for pagination keyboard interactions and focus management. Added comprehensive integration tests validating tab navigation, left/right arrow key page transitions, and home/end key behavior. Removed obsolete vnode structure assertion from unit tests.

Changes

Cohort / File(s) Summary
Pagination Integration Tests
packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
Added three new integration tests for pagination keyboard and focus behavior: tab/shift+tab focus traversal across first, previous, and page buttons; left/right arrow key navigation for page transitions with onChange verification; home/end key navigation when showFirstLast is enabled. Imported pagination ID helpers (getPaginationControlId, getPaginationPageId).
Pagination Unit Tests
packages/core/src/widgets/__tests__/pagination.test.ts
Removed single test case asserting pagination vnode returns a "fragment" kind. Remaining vnode generation and keyboard routing tests unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop through the pages with keyboard in hand,
Tab and arrow keys make navigation so grand,
Focus flows smoothly from button to button,
Home and End jumps? Why, we've got 'em!
Tests now verify each keystroke's command. 🐇

🚥 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 pagination behavior' directly and concisely summarizes the main objective of the pull request, which adds test coverage for pagination keyboard behavior.
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-pagination-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__/widgetRenderer.integration.test.ts`:
- Around line 16-19: The import of getPaginationControlId and
getPaginationPageId and several submitFrame call sites are failing CI due to
Biome formatting drift; run the project's Biome formatter (or apply the
project's formatting rules) to normalize these locations—specifically reformat
the import statement that references getPaginationControlId/getPaginationPageId
and the submitFrame usages referenced in the test (submitFrame call sites around
the blocks covering lines ~1170–1251) so they match the repository's Biome style
(spacing, line breaks, trailing commas, and indentation).
🪄 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: 0705a61b-0006-436c-87f0-4819a77c2be9

📥 Commits

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

📒 Files selected for processing (2)
  • packages/core/src/app/__tests__/widgetRenderer.integration.test.ts
  • packages/core/src/widgets/__tests__/pagination.test.ts
💤 Files with no reviewable changes (1)
  • packages/core/src/widgets/tests/pagination.test.ts

Comment on lines +16 to +19
import {
getPaginationControlId,
getPaginationPageId,
} from "../../widgets/pagination.js";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix Biome formatting on the new import and submitFrame call sites.

Line 16 and Lines 1170-1251 are currently CI-blocking due to formatter drift.

Proposed formatting-only patch
-import {
-  getPaginationControlId,
-  getPaginationPageId,
-} from "../../widgets/pagination.js";
+import { getPaginationControlId, getPaginationPageId } from "../../widgets/pagination.js";
@@
-    res = renderer.submitFrame(
-      () => view(),
-      undefined,
-      viewport,
-      defaultTheme,
-      noRenderHooks(),
-    );
+    res = renderer.submitFrame(() => view(), undefined, viewport, defaultTheme, noRenderHooks());
@@
-    res = renderer.submitFrame(
-      () => view(),
-      undefined,
-      viewport,
-      defaultTheme,
-      noRenderHooks(),
-    );
+    res = renderer.submitFrame(() => view(), undefined, viewport, defaultTheme, noRenderHooks());
@@
-    res = renderer.submitFrame(
-      () => view(),
-      undefined,
-      viewport,
-      defaultTheme,
-      noRenderHooks(),
-    );
+    res = renderer.submitFrame(() => view(), undefined, viewport, defaultTheme, noRenderHooks());
@@
-    res = renderer.submitFrame(
-      () => view(),
-      undefined,
-      viewport,
-      defaultTheme,
-      noRenderHooks(),
-    );
+    res = renderer.submitFrame(() => view(), undefined, viewport, defaultTheme, noRenderHooks());

Also applies to: 1170-1176, 1182-1188, 1233-1239, 1245-1251

🧰 Tools
🪛 GitHub Actions: ci

[error] 16-16: biome check failed: Formatter would have changed import spacing/named imports formatting from multi-line to single-line.

🤖 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 16 - 19, The import of getPaginationControlId and getPaginationPageId and
several submitFrame call sites are failing CI due to Biome formatting drift; run
the project's Biome formatter (or apply the project's formatting rules) to
normalize these locations—specifically reformat the import statement that
references getPaginationControlId/getPaginationPageId and the submitFrame usages
referenced in the test (submitFrame call sites around the blocks covering lines
~1170–1251) so they match the repository's Biome style (spacing, line breaks,
trailing commas, and indentation).

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