Skip to content

Commit a0cecd8

Browse files
chore(runway): cherry-pick fix: cp-7.47.0 rm import token footer on non evm (#15768)
- fix: cp-7.47.0 rm import token footer on non evm (#15720)
1 parent 1d10873 commit a0cecd8

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

app/components/UI/Tokens/TokenList/TokenListFooter/index.test.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ describe('TokenListFooter', () => {
126126
jest.clearAllMocks();
127127
});
128128

129-
const renderComponent = (props = mockProps) =>
129+
const renderComponent = (props = mockProps, initialStore = store) =>
130130
render(
131-
<Provider store={store}>
131+
<Provider store={initialStore}>
132132
<TokenListFooter {...props} />
133133
</Provider>,
134134
);
@@ -161,7 +161,7 @@ describe('TokenListFooter', () => {
161161
});
162162
});
163163

164-
it('renders the add tokens footer link and calls goToAddToken when pressed', () => {
164+
it('renders the add tokens footer link and calls goToAddToken when pressed on EVM', () => {
165165
const { getByTestId } = renderComponent();
166166

167167
fireEvent.press(
@@ -171,6 +171,25 @@ describe('TokenListFooter', () => {
171171
expect(mockProps.goToAddToken).toHaveBeenCalledTimes(1);
172172
});
173173

174+
it('does not render the add tokens footer link Non EVM', () => {
175+
const initialStateTest = {
176+
...initialState,
177+
engine: {
178+
backgroundState: {
179+
...initialState.engine.backgroundState,
180+
MultichainNetworkController: {
181+
...initialState.engine.backgroundState.MultichainNetworkController,
182+
isEvmSelected: false,
183+
},
184+
},
185+
},
186+
};
187+
const storeTest = mockStore(initialStateTest);
188+
const { queryByTestId } = renderComponent(mockProps, storeTest);
189+
190+
expect(queryByTestId(WalletViewSelectorsIDs.IMPORT_TOKEN_FOOTER_LINK)).toBeNull();
191+
});
192+
174193
it('disables the add tokens footer link when isAddTokenEnabled is false', () => {
175194
const { getByTestId } = renderComponent({
176195
...mockProps,

app/components/UI/Tokens/TokenList/TokenListFooter/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ export const TokenListFooter = ({
116116
)}
117117
{/* render footer */}
118118
<View style={styles.footer} key={'tokens-footer'}>
119-
<TouchableOpacity
119+
{isEvmSelected && (
120+
<TouchableOpacity
120121
style={styles.add}
121122
onPress={goToAddToken}
122123
disabled={!isAddTokenEnabled}
@@ -129,6 +130,7 @@ export const TokenListFooter = ({
129130
<Text style={styles.addText}>{strings('wallet.add_tokens')}</Text>
130131
</Text>
131132
</TouchableOpacity>
133+
)}
132134
</View>
133135
</>
134136
);

0 commit comments

Comments
 (0)