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

fix: fix onChange fired without files issue #58

Merged
merged 4 commits into from
Dec 24, 2023
Merged

Conversation

yoyo837
Copy link
Member

@yoyo837 yoyo837 commented Dec 23, 2023

Copy link

codecov bot commented Dec 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6f55ae3) 96.79% compared to head (e8777c8) 97.31%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   96.79%   97.31%   +0.52%     
==========================================
  Files           5        5              
  Lines         187      186       -1     
  Branches       69       68       -1     
==========================================
  Hits          181      181              
+ Misses          6        5       -1     

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

@@ -90,6 +90,9 @@ describe('Input', () => {
fireEvent.change(inputEl, {
target: { files: [file] },
});

expect(onChange).toHaveBeenCalled();
expect(onChange.mock.calls[0][0].target.files[0]).toBe(file);
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding this test case without fix can make the test fail.

src/utils/commonUtils.ts Outdated Show resolved Hide resolved
src/utils/commonUtils.ts Outdated Show resolved Hide resolved
@afc163 afc163 merged commit 9640649 into master Dec 24, 2023
9 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix-files-onchange branch December 24, 2023 06:38
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.

Empty e.target.files in onChange handler for Input type="file" in Safari only
2 participants