File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
packages/components/src/FormSelect/components Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,19 @@ import React from "react";
3
3
import { Option } from "../types" ;
4
4
import css from "./index.module.css" ;
5
5
6
- export default function CustomOption < T , OptionType extends Option < T > > ( props : {
6
+ type Props < OptionType > = {
7
7
data : OptionType ;
8
- } ) {
8
+ dataCyPrefix : string ;
9
+ } ;
10
+
11
+ export default function CustomOption < T , OptionType extends Option < T > > (
12
+ props : Props < OptionType > ,
13
+ ) {
9
14
return (
10
15
< span
11
16
className = { cx ( { [ css . withIconPath ] : ! ! props . data . iconPath } ) }
12
17
aria-label = { String ( props . data . value ) }
13
- data-cy = { String ( props . data . value ) }
18
+ data-cy = { ` ${ props . dataCyPrefix } - ${ props . data . value } ` }
14
19
>
15
20
{ props . data . iconPath && (
16
21
< img src = { props . data . iconPath } alt = { props . data . label } />
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export default function OptionComponent<
13
13
> ( props : OptionProps < OptionType , IsMulti > ) : JSX . Element {
14
14
return (
15
15
< components . Option { ...props } >
16
- < CustomOption data = { props . data } />
16
+ < CustomOption data = { props . data } dataCyPrefix = "select-option" />
17
17
</ components . Option >
18
18
) ;
19
19
}
@@ -28,7 +28,7 @@ export function OptionForGroup<
28
28
< FiCheck
29
29
className = { cx ( css . check , { [ css . checkInvisible ] : ! props . isSelected } ) }
30
30
/>
31
- < CustomOption data = { props . data } />
31
+ < CustomOption data = { props . data } dataCyPrefix = "select-option" />
32
32
</ components . Option >
33
33
) ;
34
34
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export default function SingleValueComponent<
10
10
> ( props : SingleValueProps < OptionType , IsMulti > ) : JSX . Element {
11
11
return (
12
12
< components . SingleValue { ...props } >
13
- < CustomOption data = { props . data } />
13
+ < CustomOption data = { props . data } dataCyPrefix = "single-value" />
14
14
</ components . SingleValue >
15
15
) ;
16
16
}
You can’t perform that action at this time.
0 commit comments