Skip to content

test: cover Escape tooltip integration - #543

Open
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/tooltip-escape-integration
Open

test: cover Escape tooltip integration#543
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/tooltip-escape-integration

Conversation

@nrps9909

@nrps9909 nrps9909 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an integration regression for closing an uncontrolled click Tooltip with Escape
  • explicitly exercise the real @rc-component/trigger dependency instead of Tooltip's manual Trigger mock
  • verify both the public visibility callback and rendered popup state

Closes #510.

Why

Escape handling is implemented by the current Trigger/Portal stack, but Tooltip's regular unit tests resolve @rc-component/trigger to the repository's manual mock. Those tests therefore cannot detect a dependency or wiring regression that makes an open Tooltip ignore Escape.

The new test keeps the existing fast mocked suite intact and adds one focused cross-package boundary check. It opens an uncontrolled click Tooltip, verifies onVisibleChange(true) and the visible popup, dispatches Escape on the owning window, then verifies onVisibleChange(false) and the hidden popup.

Causal validation

I temporarily disabled only Trigger's onEsc handoff to Portal in the installed dependency. The new test failed because the callback's last and only value remained true. Restoring the exact dependency made it pass again. The temporary dependency edit was not committed.

Verification

  • npm test -- --runInBand — 3 suites, 31 tests
  • npm run tsc
  • npm run lint -- --max-warnings=100
  • npx prettier --check tests/escape.integration.test.tsx
  • npm run compile — ESM, CJS, declarations, and both Less bundles
  • git diff --check

AI assistance disclosure: Codex was used to trace the mocked and real dependency paths, prepare and causally reverse the integration regression, run validation, and draft this PR. I verified the final diff, signed commit, and all results above.

Summary by CodeRabbit

  • 测试
    • 新增集成测试,验证通过点击打开的 Tooltip 可使用 Escape 键关闭。
    • 覆盖 Tooltip 显示状态变化及隐藏样式的正确表现。

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dd0a40d8-ea60-4979-8f38-e58601fa1ca0

📥 Commits

Reviewing files that changed from the base of the PR and between a43ecc7 and ff2f4c8.

📒 Files selected for processing (1)
  • tests/escape.integration.test.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

新增集成测试。测试使用真实 @rc-component/trigger,验证不受控 click Tooltip 在按下 Escape 键后关闭。

Changes

Tooltip Escape 关闭

Layer / File(s) Summary
Escape 关闭行为验证
tests/escape.integration.test.tsx
测试启用真实 Trigger,点击按钮并验证 Tooltip 打开。测试随后触发 Escape 键,并验证 onVisibleChange(false) 调用及 rc-tooltip-hidden 类。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to ff2f4

This change adds focused regression coverage without altering production behavior, and no actionable merge-blocking risk remains after normal checks and review.

Poem

小兔打开 Tooltip 门,
真实 Trigger 轻轻跟。
Escape 键声落下来,
隐藏类名排成行。
回调变成 false,
测试安心蹦两蹦。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:为 Tooltip 的 Escape 关闭行为增加集成测试。标题简洁、具体,并与 PR 内容一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a43ecc7) to head (ff2f4c8).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #543   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           38        38           
  Branches        15        15           
=========================================
  Hits            38        38           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Tooltip cannot be closed with Escape key

1 participant