Kimaya
Kimaya

Reputation: 1420

How do we add a data-testid to an error field of a textField component

I tried this

<TextInputField value={emailValue} error={emailError} errorProps={{ 'data-testid': 'emailError' }} helperText={emailError && 'Enter email address in format: [email protected]'} type='email' length={100} onChangeAction={setEmail} label='Email' />

But this does not set a data-testId on the error field.

Upvotes: 0

Views: 783

Answers (1)

 Kimaya
Kimaya

Reputation: 1420

I had to put FormHelperTextProps={{ 'data-testid': 'emailError' }} and not errorProps

Upvotes: 2

Related Questions