Skip to content

InputField dataTest prop doesn't target the input itself #218

Answered by Mohammer5
martinkrulltott asked this question in Q&A
Discussion options

You must be logged in to vote

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 a data-test attribute (the InputFields, Boxes and Input's outer containers). We only pass down the dataTest 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 an input

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
11 replies
@HendrikThePendric
Comment options

@martinkrulltott
Comment options

@ghost
Comment options

@amcgee
Comment options

@varl
Comment options

Answer selected by varl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants