-
Notifications
You must be signed in to change notification settings - Fork 4.9k
修复picker一些列问题,适配harmony侧,内置大屏放大计算,增加暗黑模式 #18654
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
Merged
+309
−74
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5ef8a87
fix: 修复picker滚动异常
8e22875
chore(release): publish 4.1.9-beta.0 --tag=beta
b2211b6
fix: 修复video组件在controls为false时仍然展示控制栏的问题
e4b4ced
fix: picker增加Harmony适配
332426c
chore(release): publish 4.1.9-beta.1 --tag=beta
d1134bb
fix: picker计算加上兼容回填计算
ca86cca
chore(release): publish 4.1.9-beta.2 --tag=beta
57513ec
fix: 修复picker在大屏模式下放大比例异常的问题
2539f94
chore(release): publish 4.1.9-beta.3 --tag=beta
8f268fd
feat: picker增加暗黑模式,增加部分颜色参数暴露
e31086e
chore(release): publish 4.1.9-beta.4 --tag=beta
781e60b
fix: 修复picker判断异常问题
b5b488e
chore(release): publish 4.1.9-beta.5 --tag=beta
df4c12d
fix: 补全单元测试缺失的api
fb7c25f
fix: 回退版本号
6ac7cd1
Merge branch 'main' into feat/4.1.9-feat
Single-Dancer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: NervJS/taro
Length of output: 2054
🏁 Script executed:
Repository: NervJS/taro
Length of output: 2153
🏁 Script executed:
Repository: NervJS/taro
Length of output: 15338
Verify the test impact and fix necessity with eventCenter mock
Based on verification, the review comment is partially correct but misfocused:
✅ Real issue: The jest.mock completely replaces
@tarojs/taroand omitsTaro.eventCenter, which is used inpull-down-refresh/index.tsx(lines 130, 137). Currently low-impact because pull-down-refresh has no tests, but it's a latent risk.❌ Not an issue:
mockGetSystemInfoonly supports callback style, but code only uses callbacks (picker-group.tsx line 44). No Promise-style usage exists, so the defensive Promise wrapping suggestion is unnecessary.The review should prioritize the incomplete mock risk over the hypothetical Promise concern. The suggested
jest.requireActualapproach is sound and recommended.Taro.getSystemInfo mock 应确保完整 mock @tarojs/taro 模块中的其他 API
好主意把 Picker 依赖的系统信息提出来做全局 mock。但有一个需要尽早规避的潜在风险:
当前 jest.mock 只提供了 getSystemInfo,遗漏了其他 Taro API:
pull-down-refresh/index.tsx中使用了Taro.eventCenter.on()和Taro.eventCenter.off()(第 130、137 行)undefined,导致测试失败jest.requireActual做部分 mock,将真实模块的内容透传,只覆盖需要 mock 的getSystemInfo:jest.mock('@tarojs/taro', () => { + const actual = jest.requireActual('@tarojs/taro') return { __esModule: true, + ...actual, - default: { + default: { + ...actual.default, getSystemInfo: mockGetSystemInfo, }, getSystemInfo: mockGetSystemInfo, } })这样既能保证 Picker 的系统信息 mock 生效,又不会破坏其他组件对 Taro API 的依赖。
🤖 Prompt for AI Agents