Skip to content

Commit 0f23f2b

Browse files
committed
fix: rename tabTestID to testID for React Native convention consistency
Renames the `tabTestID` prop to `testID` across TabsBar, TabsList types and components, and PerpsMarketTabs consumer. Also adds missing `tab.testID` fallback in the non-scrollable TabsBar branch.
1 parent e34cb1c commit 0f23f2b

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

app/component-library/components-temp/Tabs/TabsBar/TabsBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ const TabsBar: React.FC<TabsBarProps> = ({
308308
isDisabled={tab.isDisabled}
309309
onPress={() => handleTabPress(index)}
310310
onLayout={(layoutEvent) => handleTabLayout(index, layoutEvent)}
311-
testID={tab.tabTestID ?? `${testID}-tab-${index}`}
311+
testID={tab.testID ?? `${testID}-tab-${index}`}
312312
/>
313313
))}
314314

@@ -337,7 +337,7 @@ const TabsBar: React.FC<TabsBarProps> = ({
337337
isDisabled={tab.isDisabled}
338338
onPress={() => handleTabPress(index)}
339339
onLayout={(layoutEvent) => handleTabLayout(index, layoutEvent)}
340-
testID={`${testID}-tab-${index}`}
340+
testID={tab.testID ?? `${testID}-tab-${index}`}
341341
/>
342342
))}
343343

app/component-library/components-temp/Tabs/TabsBar/TabsBar.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface TabItem {
1212
label: string;
1313
content: React.ReactNode;
1414
isDisabled?: boolean;
15-
tabTestID?: string;
15+
testID?: string;
1616
}
1717

1818
/**

app/component-library/components-temp/Tabs/TabsList/TabsList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const TabsList = forwardRef<TabsListRef, TabsListProps>(
3939
const props = (child as React.ReactElement).props as {
4040
tabLabel?: string;
4141
isDisabled?: boolean;
42-
tabTestID?: string;
42+
testID?: string;
4343
};
4444
const tabLabel = props.tabLabel || `Tab ${index + 1}`;
4545
const isDisabled = props.isDisabled || false;
@@ -50,7 +50,7 @@ const TabsList = forwardRef<TabsListRef, TabsListProps>(
5050
content: child,
5151
isDisabled,
5252
isLoaded: false,
53-
tabTestID: props.tabTestID,
53+
testID: props.testID,
5454
};
5555
}),
5656
[children],

app/component-library/components-temp/Tabs/TabsList/TabsList.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface TabItem {
1515
label: string;
1616
content: React.ReactNode;
1717
isDisabled?: boolean;
18-
tabTestID?: string;
18+
testID?: string;
1919
}
2020

2121
/**

app/components/UI/Perps/components/PerpsMarketTabs/PerpsMarketTabs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ const PerpsMarketTabs: React.FC<PerpsMarketTabsProps> = ({
626626
() => ({
627627
key: 'position-tab',
628628
tabLabel: strings('perps.market.position'),
629-
tabTestID: PerpsMarketTabsSelectorsIDs.POSITION_TAB,
629+
testID: PerpsMarketTabsSelectorsIDs.POSITION_TAB,
630630
position,
631631
showIcon: true,
632632
onAutoClosePress: handleAutoClosePress,
@@ -640,7 +640,7 @@ const PerpsMarketTabs: React.FC<PerpsMarketTabsProps> = ({
640640
() => ({
641641
key: 'orders-tab',
642642
tabLabel: strings('perps.market.orders'),
643-
tabTestID: PerpsMarketTabsSelectorsIDs.ORDERS_TAB,
643+
testID: PerpsMarketTabsSelectorsIDs.ORDERS_TAB,
644644
sortedUnfilledOrders,
645645
activeTPOrderId,
646646
activeSLOrderId,
@@ -662,7 +662,7 @@ const PerpsMarketTabs: React.FC<PerpsMarketTabsProps> = ({
662662
() => ({
663663
key: 'statistics-tab',
664664
tabLabel: strings('perps.market.statistics'),
665-
tabTestID: PerpsMarketTabsSelectorsIDs.STATISTICS_TAB,
665+
testID: PerpsMarketTabsSelectorsIDs.STATISTICS_TAB,
666666
symbol,
667667
onTooltipPress: handleTooltipPress,
668668
nextFundingTime,

0 commit comments

Comments
 (0)