-
-
Notifications
You must be signed in to change notification settings - Fork 589
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: Fix the shadow issue when scrollX is smaller than the sum of col… #1199
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough在此次拉取请求中, Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
🧰 Additional context used🔇 Additional comments (1)
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 (
|
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
🧹 Outside diff range and nitpick comments (1)
tests/FixedColumn.spec.tsx (1)
345-377
: 新测试用例有效验证了滚动阴影问题这个新增的测试用例很好地验证了当
scrollX
小于所有列宽之和时右侧阴影的显示问题。测试结构清晰,并且正确模拟了滚动行为。为了进一步增强测试的健壮性,建议考虑以下改进:
- 添加一个额外的断言,验证初始状态下(未滚动时)是否只显示右侧阴影。
- 考虑测试滚动到最右侧时,是否只显示左侧阴影。
这些额外的检查可以确保阴影在不同滚动状态下的正确行为。例如:
wrapper.update(); expect(wrapper.find('.rc-table').hasClass('rc-table-ping-left')).toBeTruthy(); expect(wrapper.find('.rc-table').hasClass('rc-table-ping-right')).toBeTruthy(); + +// 滚动到最右侧 +act(() => { + wrapper + .find('.rc-table-content') + .props() + .onScroll({ + currentTarget: { + scrollLeft: 400, + scrollWidth: 800, + clientWidth: 400, + }, + } as any); +}); +wrapper.update(); +expect(wrapper.find('.rc-table').hasClass('rc-table-ping-left')).toBeTruthy(); +expect(wrapper.find('.rc-table').hasClass('rc-table-ping-right')).toBeFalsy();这些额外的断言将有助于确保阴影在各种滚动情况下都能正确显示。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- src/Table.tsx (1 hunks)
- tests/FixedColumn.spec.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
src/Table.tsx (1)
458-461
: 优化scrollWidth
的计算逻辑此更改使
scrollWidth
的计算方式与useColumns
中的逻辑保持一致。当useInternalHooks
和tailor
为真且mergedScrollX
为数字类型时,使用mergedScrollX
,否则使用measureTarget.scrollWidth
。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1199 +/- ##
==========================================
+ Coverage 97.71% 97.75% +0.03%
==========================================
Files 75 75
Lines 7451 7484 +33
Branches 1116 1121 +5
==========================================
+ Hits 7281 7316 +35
+ Misses 164 162 -2
Partials 6 6 ☔ View full report in Codecov by Sentry. |
fix ant-design/ant-design#51170