Skip to content

Commit abb81bb

Browse files
committed
feat: add name to segmented control props
1 parent 394998b commit abb81bb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Common/SegmentedControl/SegmentedControl.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ const SegmentedControl = ({
2525
tooltips,
2626
disabled = false,
2727
rootClassName = '',
28+
name,
2829
variant = SegmentedControlVariant.WHITE_ON_GRAY,
2930
}: SegmentedControlProps) => (
3031
<StyledRadioGroup
3132
className={`${variant} ${rootClassName}`}
3233
onChange={onChange}
3334
initialTab={initialTab}
34-
name="segmented-control"
35+
name={name}
3536
disabled={disabled}
3637
>
3738
{tabs.map((tab: OptionType, index) => (
@@ -41,6 +42,7 @@ const SegmentedControl = ({
4142
className="fs-12 cn-7 fw-6 lh-20"
4243
showTippy={!!tooltips?.[index]}
4344
tippyContent={tooltips?.[index] ?? ''}
45+
dataTestId={`${name}-${tab.value}`}
4446
>
4547
{tab.label}
4648
</StyledRadioGroup.Radio>

src/Common/SegmentedControl/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface SegmentedControlProps {
2626
tabs: OptionType[]
2727
initialTab: string
2828
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
29+
name: string
2930
tooltips?: string[]
3031
disabled?: boolean
3132
rootClassName?: string

0 commit comments

Comments
 (0)