Skip to content
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

ImageUploader增加手动上传功能 #6289 #6311

Closed
wants to merge 12 commits into from

Conversation

19Qingfeng
Copy link
Contributor

@19Qingfeng 19Qingfeng commented Aug 11, 2023

刚好看到,随手加了下。不过有点不太确定的是

// src/components/image-uploader/tests/image-uploader.test.tsx
      const onOpen = () => {
        Object.defineProperty(imageRef.current, 'openPhoto', {
          value: () => {
            openPhoto()
          },
        })
        imageRef.current?.openPhoto()
      }

这里的 test 实在想不出什么好的办法去测试 openPhoto 方法,希望大佬们赐教。

@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Patch coverage: 87.50% and project coverage change: -0.01% ⚠️

Comparison is base (46ffd90) 91.56% compared to head (548b4e6) 91.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6311      +/-   ##
==========================================
- Coverage   91.56%   91.55%   -0.01%     
==========================================
  Files         306      306              
  Lines        6591     6598       +7     
  Branches     1627     1628       +1     
==========================================
+ Hits         6035     6041       +6     
- Misses        521      522       +1     
  Partials       35       35              
Files Changed Coverage Δ
src/components/image-uploader/index.ts 100.00% <ø> (ø)
src/components/image-uploader/image-uploader.tsx 93.47% <87.50%> (-0.42%) ⬇️

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

@github-actions
Copy link
Contributor

PR preview has been successfully built and deployed to https://antd-mobile-preview-pr-6311.surge.sh

get nativeElement() {
return inputRef.current
},
openPhoto: () => inputRef.current?.click(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得 openPhoto 就不用暴露了,本质就是 input.click(),有 nativeElement 够了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好滴 我修改下

src/components/image-uploader/demos/demo2.tsx Show resolved Hide resolved
@1587315093
Copy link
Contributor

分支把之前得 commit 带进来了

@19Qingfeng
Copy link
Contributor Author

19Qingfeng commented Aug 14, 2023

see: #6316

@19Qingfeng 19Qingfeng closed this Aug 14, 2023
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.

3 participants