Skip to content

test(query-devtools/Devtools): add tests for resize handle#10691

Merged
sukvvon merged 3 commits intomainfrom
test/query-devtools-devtools-resize-handle
May 11, 2026
Merged

test(query-devtools/Devtools): add tests for resize handle#10691
sukvvon merged 3 commits intomainfrom
test/query-devtools-devtools-resize-handle

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 11, 2026

🎯 Changes

Adds tests for the resize handle in Devtools.tsx, covering 6 cases:

  • should increase height when "ArrowUp" is pressed on the resize handle in "bottom" position
  • should decrease height when "ArrowDown" is pressed on the resize handle in "bottom" position
  • should increase width when "ArrowLeft" is pressed on the resize handle in "right" position
  • should decrease width when "ArrowRight" is pressed on the resize handle in "right" position
  • should increase height while dragging up in "bottom" position
  • should increase width while dragging left in "right" position

The drag-flow tests stub getBoundingClientRect on the panel since jsdom does not perform layout, so the production resize math can use a non-zero base size and meaningful assertions like toBeGreaterThan(initialHeight).

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Added test coverage for the devtools resize handle: verifies keyboard arrow behavior and mouse-drag interactions, ensures panel height/width persist correctly in bottom/right placements, and accounts for test-environment sizing quirks.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 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: 0b9cff11-cde2-4eb0-b6c2-741747403cbb

📥 Commits

Reviewing files that changed from the base of the PR and between c2e5c0a and 012b516.

📒 Files selected for processing (1)
  • packages/query-devtools/src/__tests__/Devtools.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/query-devtools/src/tests/Devtools.test.tsx

📝 Walkthrough

Walkthrough

This PR adds tests for devtools panel resizing: keyboard ArrowUp/ArrowDown on the bottom handle and ArrowLeft/ArrowRight on the right handle update persisted dimensions in localStorage; mouse drag simulations for bottom/right positions verify the same behavior with stubbed element geometry.

Changes

Resize Handle Tests

Layer / File(s) Summary
Bottom position keyboard resize
packages/query-devtools/src/__tests__/Devtools.test.tsx
Tests for ArrowUp (increases height) and ArrowDown (decreases height) keyboard interactions on resize handle positioned at bottom.
Right position keyboard resize
packages/query-devtools/src/__tests__/Devtools.test.tsx
Tests for ArrowLeft (increases width) and ArrowRight (decreases width) keyboard interactions on resize handle positioned at right.
Mouse drag resize interactions
packages/query-devtools/src/__tests__/Devtools.test.tsx
Tests simulate mouse drag operations: upward drag in bottom position increases height; leftward drag in right position increases width. Panel geometry is stubbed to avoid jsdom sizing issues.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A handle nudged, a panel grows,
Arrow taps and dragging shows,
Heights and widths in storage stay,
Tests hop in to make their play,
LocalStorage holds the rows.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding tests for the resize handle functionality in query-devtools/Devtools.
Description check ✅ Passed The description is comprehensive and well-structured, covering all required sections: changes, checklist items completed, and release impact clearly marked. It provides detailed information about the six test cases and the approach taken.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 test/query-devtools-devtools-resize-handle

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 11, 2026

View your CI Pipeline Execution ↗ for commit a7749fc

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 49s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-11 01:08:04 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

Copy link
Copy Markdown
Contributor

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/query-devtools/src/__tests__/Devtools.test.tsx`:
- Around line 967-970: The test converts
localStorage.getItem('TanstackQueryDevtools.height') directly with Number(...),
which treats null as 0 and can hide missing writes; update the assertions in
Devtools.test.tsx (the tests that reference 'TanstackQueryDevtools.height'
around the decrease checks) to first assert the stored value is not null (or
defined) and then convert/parse it (e.g., parseInt) before asserting it is
lessThan(500) or compared for decreases so a missing key fails the test rather
than appearing as 0.
🪄 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: 7411f094-481a-4c2c-9f45-5b0a89835672

📥 Commits

Reviewing files that changed from the base of the PR and between fdea97d and a7749fc.

📒 Files selected for processing (1)
  • packages/query-devtools/src/__tests__/Devtools.test.tsx

Comment thread packages/query-devtools/src/__tests__/Devtools.test.tsx Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10691

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10691

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@10691

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10691

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10691

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10691

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10691

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10691

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10691

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10691

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10691

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10691

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10691

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10691

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10691

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10691

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10691

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10691

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10691

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10691

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10691

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10691

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10691

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10691

commit: 012b516

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

size-limit report 📦

Path Size
react full 12.1 KB (0%)
react minimal 9.07 KB (0%)

sukvvon added 2 commits May 11, 2026 10:03
…d of 'not.toBeNull' for stronger 'getBoundingClientRect' guarantee
…torage' value to prevent 'Number(null) === 0' false positive in decrease assertions
@sukvvon sukvvon self-assigned this May 11, 2026
@sukvvon sukvvon merged commit ba58314 into main May 11, 2026
8 checks passed
@sukvvon sukvvon deleted the test/query-devtools-devtools-resize-handle branch May 11, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant