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(upload): FileList item function must return null instead undefined when it can't find a file #288

Merged

Conversation

vadimshvetsov
Copy link
Contributor

@vadimshvetsov vadimshvetsov commented May 20, 2020

I was looking at FileList implementation and noted that item function must return File or null instead undefined. Here is jsdom implementation of it. Also fix wrong expectation in test that's not cause an error when it must. Also I removed unnecessary expectations in upload tests.

target: { files: { item: () => {}, length: 0 } },
});

expect(input.files[0]).toBeUndefined();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests do nothing special to user-event library. They only checks that fireEvent function works properly.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Makes sense 👍 thanks!

@kentcdodds kentcdodds merged commit 9634863 into testing-library:master May 20, 2020
@Gpx
Copy link
Member

Gpx commented May 20, 2020

🎉 This PR is included in version 10.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Gpx Gpx added the released label May 20, 2020
@vadimshvetsov vadimshvetsov deleted the fix-upload-item-function branch May 20, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants