Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ describe('OndoCampaignRwaSelectorView', () => {

it('navigates back when back button is pressed', () => {
const { getByTestId } = render(<OndoCampaignRwaSelectorView />);
fireEvent.press(getByTestId('header-back-button'));
fireEvent.press(getByTestId('ondo-rwa-selector-header-back-button'));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale HeaderCompactStandard mock is now dead code

Low Severity

The jest.mock for HeaderCompactStandard (lines 74–123) is now dead code. Since TrendingListHeader was changed to import HeaderStandard from @metamask/design-system-react-native instead of HeaderCompactStandard from components-temp, this ~50-line mock block is never exercised during any test in the file. It adds maintenance burden and could confuse future contributors into thinking the mock's hardcoded testID values (e.g. header-back-button, header-title) are still relevant.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 030a1cd. Configure here.

expect(mockGoBack).toHaveBeenCalledTimes(1);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { useNavigation } from '@react-navigation/native';
import {
HeaderSearch,
HeaderSearchVariant,
HeaderStandard,
IconName as DSIconName,
} from '@metamask/design-system-react-native';
import { strings } from '../../../../../../locales/i18n';
import HeaderCompactStandard from '../../../../../component-library/components-temp/HeaderCompactStandard';
import type { TrendingListHeaderProps } from './TrendingListHeader.types';

/**
Expand Down Expand Up @@ -98,7 +98,7 @@ const TrendingListHeader: React.FC<TrendingListHeaderProps> = ({
}

return (
<HeaderCompactStandard
<HeaderStandard
title={title || strings('trending.trending_tokens')}
onBack={handleBack}
backButtonProps={{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useRef, useState, useCallback, useEffect } from 'react';
import { HeaderStandard } from '@metamask/design-system-react-native';
import { StyleSheet, ScrollView } from 'react-native';
import BottomSheet, {
BottomSheetRef,
} from '../../../../../component-library/components/BottomSheets/BottomSheet';
import HeaderCompactStandard from '../../../../../component-library/components-temp/HeaderCompactStandard';
import Icon, {
IconName,
IconSize,
Expand Down Expand Up @@ -115,7 +115,7 @@ const TrendingTokenNetworkBottomSheet: React.FC<
onClose={handleSheetClose}
testID="trending-token-network-bottom-sheet"
>
<HeaderCompactStandard
<HeaderStandard
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close button may silently disappear in bottom sheets

High Severity

The old HeaderCompactStandard explicitly converted onClose/closeButtonProps into a close ButtonIcon added to endButtonIconProps. Every existing usage of HeaderStandard in the codebase (MoneyHeader, PerpsHomeHeader) uses only onBack/backButtonProps/endButtonIconProps — none pass onClose or closeButtonProps. If HeaderStandard doesn't implement the same convenience-prop-to-button transformation, the close button in all three bottom sheets silently vanishes without any error.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3bfd0f2. Configure here.

title={strings('trending.networks')}
onClose={handleClose}
closeButtonProps={{ testID: 'close-button' }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useRef, useState, useCallback, useEffect } from 'react';
import { HeaderStandard } from '@metamask/design-system-react-native';
import { View, StyleSheet, TouchableOpacity, Platform } from 'react-native';
import { useTheme } from '../../../../../util/theme';
import BottomSheet, {
Expand All @@ -14,7 +15,6 @@ import Icon, {
IconColor,
} from '../../../../../component-library/components/Icons/Icon';
import { strings } from '../../../../../../locales/i18n';
import HeaderCompactStandard from '../../../../../component-library/components-temp/HeaderCompactStandard';
import Button, {
ButtonVariants,
ButtonWidthTypes,
Expand Down Expand Up @@ -149,7 +149,7 @@ const TrendingTokenPriceChangeBottomSheet: React.FC<
onClose={handleSheetClose}
testID="trending-token-price-change-bottom-sheet"
>
<HeaderCompactStandard
<HeaderStandard
title={strings('trending.sort_by')}
onClose={handleClose}
closeButtonProps={{ testID: 'close-button' }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useRef, useState, useCallback, useEffect } from 'react';
import { HeaderStandard } from '@metamask/design-system-react-native';
import { View, StyleSheet, TouchableOpacity } from 'react-native';
import { useTheme } from '../../../../../util/theme';
import BottomSheet, {
Expand All @@ -7,7 +8,6 @@ import BottomSheet, {
import Text, {
TextVariant,
} from '../../../../../component-library/components/Texts/Text';
import HeaderCompactStandard from '../../../../../component-library/components-temp/HeaderCompactStandard';
import Icon, {
IconName,
IconSize,
Expand Down Expand Up @@ -139,7 +139,7 @@ const TrendingTokenTimeBottomSheet: React.FC<
onClose={handleSheetClose}
testID="trending-token-time-bottom-sheet"
>
<HeaderCompactStandard
<HeaderStandard
title={strings('trending.time')}
onClose={handleClose}
closeButtonProps={{ testID: 'close-button' }}
Expand Down
Loading