test(query-devtools/Devtools): add tests for resize handle#10691
test(query-devtools/Devtools): add tests for resize handle#10691
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis 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. ChangesResize Handle Tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit a7749fc
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
packages/query-devtools/src/__tests__/Devtools.test.tsx
size-limit report 📦
|
…d of 'not.toBeNull' for stronger 'getBoundingClientRect' guarantee
…torage' value to prevent 'Number(null) === 0' false positive in decrease assertions
🎯 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" positionshould decrease height when "ArrowDown" is pressed on the resize handle in "bottom" positionshould increase width when "ArrowLeft" is pressed on the resize handle in "right" positionshould decrease width when "ArrowRight" is pressed on the resize handle in "right" positionshould increase height while dragging up in "bottom" positionshould increase width while dragging left in "right" positionThe drag-flow tests stub
getBoundingClientRecton the panel since jsdom does not perform layout, so the production resize math can use a non-zero base size and meaningful assertions liketoBeGreaterThan(initialHeight).✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit