1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Fix issue with dapp suggested option being visible in edit gas fee popover even if dapp has no gas suggestion (#13316)

This commit is contained in:
Jyoti Puri 2022-01-18 23:07:52 +05:30 committed by GitHub
parent d12097ac1c
commit bd33512c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

@ -79,7 +79,7 @@ const render = ({ txProps, contextProps } = {}) => {
describe('EditGasFeePopover', () => {
it('should renders low / medium / high options', () => {
render({ txProps: { dappSuggestedGasFees: {} } });
render({ txProps: { dappSuggestedGasFees: { maxFeePerGas: '0x5208' } } });
expect(screen.queryByText('🐢')).toBeInTheDocument();
expect(screen.queryByText('🦊')).toBeInTheDocument();

View File

@ -64,7 +64,8 @@ const EditGasItem = ({ priorityLevel }) => {
if (
priorityLevel === PRIORITY_LEVELS.DAPP_SUGGESTED &&
!dappSuggestedGasFees
!dappSuggestedGasFees?.maxFeePerGas &&
!dappSuggestedGasFees?.gasPrice
) {
return null;
}

View File

@ -150,6 +150,23 @@ describe('EditGasItem', () => {
expect(screen.queryByTitle('0.0000315 ETH')).toBeInTheDocument();
});
it('should not renders site gas estimate option for priorityLevel dappSuggested if site does not provided gas estimates', () => {
renderComponent({
componentProps: { priorityLevel: 'dappSuggested' },
transactionProps: {},
});
expect(
screen.queryByRole('button', { name: 'dappSuggested' }),
).not.toBeInTheDocument();
renderComponent({
componentProps: { priorityLevel: 'dappSuggested' },
transactionProps: { dappSuggestedGasFees: { gas: '0x59682f10' } },
});
expect(
screen.queryByRole('button', { name: 'dappSuggested' }),
).not.toBeInTheDocument();
});
it('should renders advance gas estimate option for priorityLevel custom', () => {
renderComponent({
componentProps: { priorityLevel: 'custom' },