Skip to content

Commit e6f47dc

Browse files
authored
Merge pull request #92 from input-output-hk/feat/add-testids-for-textbox
feat: add test ids for text box
2 parents dea7bde + 586e7d0 commit e6f47dc

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/design-system/text-box/text-box.component.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,35 @@ export const TextBox = ({
6464
onChange={onChange}
6565
id={id}
6666
maxLength={maxLength}
67-
data-testid={rest['data-testid']}
67+
data-testid={
68+
rest['data-testid']
69+
? `${rest['data-testid']}-input`
70+
: 'text-box-input'
71+
}
6872
/>
6973
</Form.Control>
70-
<Form.Label className={cn(cx.label)}>{label}</Form.Label>
74+
<Form.Label
75+
className={cn(cx.label)}
76+
data-testid={
77+
rest['data-testid']
78+
? `${rest['data-testid']}-label`
79+
: 'text-box-label'
80+
}
81+
>
82+
{label}
83+
</Form.Label>
7184
</Form.Field>
7285
</Flex>
7386
{errorMessage && (
74-
<Text.Label color="error" className={cx.errorMessage}>
87+
<Text.Label
88+
color="error"
89+
className={cx.errorMessage}
90+
data-testid={
91+
rest['data-testid']
92+
? `${rest['data-testid']}-error`
93+
: 'text-box-error'
94+
}
95+
>
7596
{errorMessage}
7697
</Text.Label>
7798
)}

0 commit comments

Comments
 (0)