Closed mo-alaa closed 2 years ago
How is the hidden input used? If it's in a form whose data you use, test submitting it and check for data.
It's generally hard to give good advise without knowing the full UI.
since the input 'file' doesn't have a role by default
the default role of a file input is button
@alexkrolick that's probably a chrome decision and not a spec definition so I guess it might not work in JSDOM. Based on the spec, as @mo-alaa said, input type file has no implicit role:
Closing in favor of https://testing-library.com/discord. The documentation still applies. But concrete advise depends on the actual UI.
Hi, I have a hidden input inside a button to upload files.
since the input 'file' doesn't have a role by default, should I add an
"aria-label"
or a"data-testid"
for the input element?Because as said here : 'The first rule of aria is don't use aria'.
Also testing library says this about using
data-testid
: 'Using data-testid attributes do not resemble how your software is used and should be avoided if possible'so what should I pick ?