-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix:render rx with 2 when gap.radius is 0 #68
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Caution Review failedThe pull request is closed. Walkthrough此次更改引入了一个新的实用函数 Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Co-authored-by: afc163 <afc163@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/hooks/useTarget.ts (2 hunks)
- tests/index.test.tsx (1 hunks)
Additional comments not posted (3)
src/hooks/useTarget.ts (2)
19-21
: 检查数字有效性的实现正确。该函数正确地检查了一个值是否为数字且不是 NaN,这是处理数字验证的标准方法。
87-87
: 改进gapRadius
的处理逻辑。通过使用
isValidNumber
函数来检查gap?.radius
的有效性,确保了gapRadius
总是一个有效的数字。这种处理方式提高了代码的健壮性和可维护性。tests/index.test.tsx (1)
1089-1117
: 新增测试用例确保gap.radius
为 0 时的行为。测试用例检查了当
gap.radius
设置为 0 时,SVG 矩形的rx
属性是否正确设置为 '0'。这是一个直接的功能测试,确保组件在特定条件下表现如预期。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #68 +/- ##
=======================================
Coverage 99.46% 99.47%
=======================================
Files 9 9
Lines 187 189 +2
Branches 85 86 +1
=======================================
+ Hits 186 188 +2
Misses 1 1 ☔ View full report in Codecov by Sentry. |
ant-design/ant-design#50574
Summary by CodeRabbit
新功能
isValidNumber
,用于验证gap?.radius
的有效性,以增强代码的健壮性。测试
Tour
组件的测试套件中新增了测试用例,确保当gap.radius
为 0 时,SVG 矩形的rx
属性正确渲染为 '0',提高了测试覆盖率。