diff --git a/app/components/UI/AssetElement/index.constants.ts b/app/components/UI/AssetElement/index.constants.ts index 1b14c68f51c..2204d5a21af 100644 --- a/app/components/UI/AssetElement/index.constants.ts +++ b/app/components/UI/AssetElement/index.constants.ts @@ -1,2 +1,2 @@ -export const FIAT_BALANCE_TEST_ID = 'fiat-balance-test-id'; -export const MAIN_BALANCE_TEST_ID = 'main-balance-test-id'; +export const BALANCE_TEST_ID = 'balance-test-id'; +export const SECONDARY_BALANCE_TEST_ID = 'secondary-balance-test-id'; diff --git a/app/components/UI/AssetElement/index.test.tsx b/app/components/UI/AssetElement/index.test.tsx index e664027b309..9c2b4caf717 100644 --- a/app/components/UI/AssetElement/index.test.tsx +++ b/app/components/UI/AssetElement/index.test.tsx @@ -3,7 +3,7 @@ import { shallow } from 'enzyme'; import { render, fireEvent } from '@testing-library/react-native'; import AssetElement from './'; import { getAssetTestId } from '../../../../wdio/screen-objects/testIDs/Screens/WalletView.testIds'; -import { FIAT_BALANCE_TEST_ID, MAIN_BALANCE_TEST_ID } from './index.constants'; +import { BALANCE_TEST_ID, SECONDARY_BALANCE_TEST_ID } from './index.constants'; describe('AssetElement', () => { const onPressMock = jest.fn(); @@ -28,7 +28,7 @@ describe('AssetElement', () => { expect(wrapper).toMatchSnapshot(); }); - it('renders the asset balance if provided', () => { + it('renders the main balance if provided', () => { const { getByText } = render( , ); @@ -56,33 +56,33 @@ describe('AssetElement', () => { expect(onLongPressMock).toHaveBeenCalledWith(erc20Token); }); - it('renders the fiat and token balance', () => { + it('renders the main and secondary balance', () => { const { getByTestId } = render( , ); - expect(getByTestId(FIAT_BALANCE_TEST_ID)).toBeDefined(); - expect(getByTestId(MAIN_BALANCE_TEST_ID)).toBeDefined(); + expect(getByTestId(BALANCE_TEST_ID)).toBeDefined(); + expect(getByTestId(SECONDARY_BALANCE_TEST_ID)).toBeDefined(); }); - it('renders the fiat balance with privacy mode', () => { + it('renders the main and secondary balance with privacy mode', () => { const { getByTestId } = render( , ); - const fiatBalance = getByTestId(FIAT_BALANCE_TEST_ID); - const mainBalance = getByTestId(MAIN_BALANCE_TEST_ID); + const mainBalance = getByTestId(BALANCE_TEST_ID); + const secondaryBalance = getByTestId(SECONDARY_BALANCE_TEST_ID); - expect(fiatBalance.props.children).toBe('•••••••••'); - expect(mainBalance.props.children).toBe('••••••'); + expect(mainBalance.props.children).toBe('•••••••••'); + expect(secondaryBalance.props.children).toBe('••••••'); }); }); diff --git a/app/components/UI/AssetElement/index.tsx b/app/components/UI/AssetElement/index.tsx index ff39a4eac1a..19b8d3135aa 100644 --- a/app/components/UI/AssetElement/index.tsx +++ b/app/components/UI/AssetElement/index.tsx @@ -16,7 +16,7 @@ import { useTheme } from '../../../util/theme'; import SensitiveText, { SensitiveTextLength, } from '../../../component-library/components/Texts/SensitiveText'; -import { FIAT_BALANCE_TEST_ID, MAIN_BALANCE_TEST_ID } from './index.constants'; +import { BALANCE_TEST_ID, SECONDARY_BALANCE_TEST_ID } from './index.constants'; interface AssetElementProps { children?: React.ReactNode; @@ -24,7 +24,7 @@ interface AssetElementProps { onPress?: (asset: TokenI) => void; onLongPress?: ((asset: TokenI) => void) | null; balance?: string; - mainBalance?: string | null; + secondaryBalance?: string; privacyMode?: boolean; } @@ -48,7 +48,7 @@ const createStyles = (colors: Colors) => skeleton: { width: 50, }, - balanceFiat: { + secondaryBalance: { color: colors.text.alternative, paddingHorizontal: 0, ...fontStyles.normal, @@ -62,8 +62,8 @@ const createStyles = (colors: Colors) => const AssetElement: React.FC = ({ children, balance, + secondaryBalance, asset, - mainBalance = null, onPress, onLongPress, privacyMode = false, @@ -101,7 +101,7 @@ const AssetElement: React.FC = ({ } isHidden={privacyMode} length={SensitiveTextLength.Medium} - testID={FIAT_BALANCE_TEST_ID} + testID={BALANCE_TEST_ID} > {balance === TOKEN_BALANCE_LOADING ? ( @@ -110,18 +110,18 @@ const AssetElement: React.FC = ({ )} )} - {mainBalance ? ( + {secondaryBalance ? ( - {mainBalance === TOKEN_BALANCE_LOADING ? ( + {secondaryBalance === TOKEN_BALANCE_LOADING ? ( ) : ( - mainBalance + secondaryBalance )} ) : null} diff --git a/app/components/UI/AssetOverview/Balance/Balance.tsx b/app/components/UI/AssetOverview/Balance/Balance.tsx index dd0efd0032b..7d278964c00 100644 --- a/app/components/UI/AssetOverview/Balance/Balance.tsx +++ b/app/components/UI/AssetOverview/Balance/Balance.tsx @@ -144,8 +144,8 @@ const Balance = ({ asset, mainBalance, secondaryBalance }: BalanceProps) => { !asset.isETH && !asset.isNative && diff --git a/app/components/UI/AssetOverview/Balance/__snapshots__/index.test.tsx.snap b/app/components/UI/AssetOverview/Balance/__snapshots__/index.test.tsx.snap index bc87f8af9cb..ae36d30fa79 100644 --- a/app/components/UI/AssetOverview/Balance/__snapshots__/index.test.tsx.snap +++ b/app/components/UI/AssetOverview/Balance/__snapshots__/index.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Balance should render correctly with a fiat balance 1`] = ` +exports[`Balance should render correctly with main and secondary balance 1`] = ` - 456 + 123 - 123 + 456 `; -exports[`Balance should render correctly without a fiat balance 1`] = ` +exports[`Balance should render correctly without a secondary balance 1`] = ` 123 diff --git a/app/components/UI/AssetOverview/Balance/index.test.tsx b/app/components/UI/AssetOverview/Balance/index.test.tsx index 724b02bc1a4..e5b054262a9 100644 --- a/app/components/UI/AssetOverview/Balance/index.test.tsx +++ b/app/components/UI/AssetOverview/Balance/index.test.tsx @@ -152,7 +152,7 @@ describe('Balance', () => { }); if (!isPortfolioViewEnabled()) { - it('should render correctly with a fiat balance', () => { + it('should render correctly with main and secondary balance', () => { const wrapper = render( , ); @@ -161,7 +161,7 @@ describe('Balance', () => { } if (!isPortfolioViewEnabled()) { - it('should render correctly without a fiat balance', () => { + it('should render correctly without a secondary balance', () => { const wrapper = render( 0 ETH @@ -2241,9 +2239,9 @@ exports[`AssetOverview should render correctly when portfolio view is enabled 1` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - 1500 + 0 ETH - 0 ETH + 1500 diff --git a/app/components/UI/NonEvmTokens/__snapshots__/index.test.tsx.snap b/app/components/UI/NonEvmTokens/__snapshots__/index.test.tsx.snap index 4476e85422f..1e8f242b791 100644 --- a/app/components/UI/NonEvmTokens/__snapshots__/index.test.tsx.snap +++ b/app/components/UI/NonEvmTokens/__snapshots__/index.test.tsx.snap @@ -554,7 +554,7 @@ exports[`NonEvmTokens should render correctly 1`] = ` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > 5.5 SOL @@ -572,7 +572,7 @@ exports[`NonEvmTokens should render correctly 1`] = ` "textTransform": "uppercase", } } - testID="main-balance-test-id" + testID="secondary-balance-test-id" > { it('should display the Solana token with correct balance', async () => { const { getByTestId, getByText } = renderComponent(); expect(getByText('Solana')).toBeDefined(); - const balanceText = getByTestId('fiat-balance-test-id'); + const balanceText = getByTestId('balance-test-id'); expect(balanceText.props.children).toBe('5.5 SOL'); }); it('should show fiat value', async () => { const { getByTestId } = renderComponent(); // With balance 5.5 and conversion rate 100, fiat value should be $550.00 - const balanceText = getByTestId('main-balance-test-id'); + const balanceText = getByTestId('secondary-balance-test-id'); expect(balanceText).toBeDefined(); }); diff --git a/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx b/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx index 380424121cb..445016e0656 100644 --- a/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx +++ b/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx @@ -207,7 +207,7 @@ const StakingBalanceContent = ({ asset }: StakingBalanceProps) => { {hasEthToUnstake && !isLoadingPooledStakesData && ( {showNetworkBadge ? ( diff --git a/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap b/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap index 55703c7d08b..58d0870c427 100644 --- a/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap +++ b/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap @@ -872,9 +872,9 @@ exports[`Tokens Portfolio View should match the snapshot when portfolio view is "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - ETH + < $0.01 - < $0.01 + ETH @@ -1134,9 +1134,9 @@ exports[`Tokens Portfolio View should match the snapshot when portfolio view is "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - < 0.00001 BAT + $0 - $0 + < 0.00001 BAT @@ -2118,9 +2118,9 @@ exports[`Tokens render matches snapshot 1`] = ` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - ETH + < $0.01 - < $0.01 + ETH @@ -2380,9 +2380,9 @@ exports[`Tokens render matches snapshot 1`] = ` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - < 0.00001 BAT + $0 - $0 + < 0.00001 BAT @@ -3364,9 +3364,9 @@ exports[`Tokens should hide zero balance tokens when setting is on 1`] = ` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - ETH + < $0.01 - < $0.01 + ETH @@ -3626,9 +3626,9 @@ exports[`Tokens should hide zero balance tokens when setting is on 1`] = ` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - < 0.00001 BAT + $0 - $0 + < 0.00001 BAT @@ -4610,9 +4610,9 @@ exports[`Tokens should render correctly 1`] = ` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - ETH + < $0.01 - < $0.01 + ETH @@ -4872,9 +4872,9 @@ exports[`Tokens should render correctly 1`] = ` "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - < 0.00001 BAT + $0 - $0 + < 0.00001 BAT @@ -5874,9 +5874,9 @@ exports[`Tokens should show all balance tokens when hideZeroBalanceTokens settin "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - ETH + < $0.01 - < $0.01 + ETH @@ -6136,9 +6136,9 @@ exports[`Tokens should show all balance tokens when hideZeroBalanceTokens settin "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - < 0.00001 BAT + $0 - $0 + < 0.00001 BAT @@ -6398,9 +6398,9 @@ exports[`Tokens should show all balance tokens when hideZeroBalanceTokens settin "lineHeight": 24, } } - testID="fiat-balance-test-id" + testID="balance-test-id" > - 0 LINK + $0 - $0 + 0 LINK