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

feature/default_network_editable
Jyoti Puri 3 years ago committed by GitHub
parent d12097ac1c
commit bd33512c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ui/components/app/edit-gas-fee-popover/edit-gas-fee-popover.test.js
  2. 3
      ui/components/app/edit-gas-fee-popover/edit-gas-item/edit-gas-item.js
  3. 17
      ui/components/app/edit-gas-fee-popover/edit-gas-item/edit-gas-item.test.js

@ -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();

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

@ -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' },

Loading…
Cancel
Save