InputField dataTest prop doesn't target the input itself #218
-
When using an
The If the purpose is to be able to target an element when testing, I suggest that the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
The currently applied strategy is to only add a I'd suggest to just use |
Beta Was this translation helpful? Give feedback.
-
I created a proposal to formalize our |
Beta Was this translation helpful? Give feedback.
The currently applied strategy is to only add a
data-test
prop to the most outer dom element of each component.The
InputField
uses two components, so there will be three dom elements with adata-test
attribute (theInputField
s,Box
es andInput
's outer containers). We only pass down thedataTest
value internally if a component consists of multiple components (like the Transfer component for example).I'd suggest to just use
[data-test="mycustomname-content"] input
. That will make the code a bit more resilient to change as the internals and/or data-test strings could change, but the element you're trying to target is probably still aninput