mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fixing Speed up/Cancel information text (#14551)
* Fixing Speed up/Cancel information text * Adding tests
This commit is contained in:
parent
fa9d703aa0
commit
a2ea1cacc8
@ -119,7 +119,9 @@ const CancelSpeedupPopover = () => {
|
|||||||
contentText={
|
contentText={
|
||||||
<Box>
|
<Box>
|
||||||
{t('cancelSpeedUpTransactionTooltip', [
|
{t('cancelSpeedUpTransactionTooltip', [
|
||||||
EDIT_GAS_MODES.CANCEL ? t('cancel') : t('speedUp'),
|
editGasMode === EDIT_GAS_MODES.CANCEL
|
||||||
|
? t('cancel')
|
||||||
|
: t('speedUp'),
|
||||||
])}
|
])}
|
||||||
<div>
|
<div>
|
||||||
<a
|
<a
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
hexWEIToDecETH,
|
hexWEIToDecETH,
|
||||||
decGWEIToHexWEI,
|
decGWEIToHexWEI,
|
||||||
} from '../../../helpers/utils/conversions.util';
|
} from '../../../helpers/utils/conversions.util';
|
||||||
|
import InfoTooltip from '../../ui/info-tooltip';
|
||||||
|
|
||||||
import CancelSpeedupPopover from './cancel-speedup-popover';
|
import CancelSpeedupPopover from './cancel-speedup-popover';
|
||||||
|
|
||||||
@ -72,6 +73,8 @@ jest.mock('../../../contexts/transaction-modal', () => ({
|
|||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
jest.mock('../../ui/info-tooltip', () => jest.fn(() => null));
|
||||||
|
|
||||||
const render = (
|
const render = (
|
||||||
props,
|
props,
|
||||||
maxFeePerGas = MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_HEX_WEI,
|
maxFeePerGas = MOCK_SUGGESTED_MEDIUM_MAXFEEPERGAS_HEX_WEI,
|
||||||
@ -111,6 +114,10 @@ const render = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
describe('CancelSpeedupPopover', () => {
|
describe('CancelSpeedupPopover', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
it('should have ❌Cancel in header if editGasMode is cancel', async () => {
|
it('should have ❌Cancel in header if editGasMode is cancel', async () => {
|
||||||
await act(async () => render());
|
await act(async () => render());
|
||||||
expect(screen.queryByText('❌Cancel')).toBeInTheDocument();
|
expect(screen.queryByText('❌Cancel')).toBeInTheDocument();
|
||||||
@ -121,6 +128,24 @@ describe('CancelSpeedupPopover', () => {
|
|||||||
expect(screen.queryByText('🚀Speed Up')).toBeInTheDocument();
|
expect(screen.queryByText('🚀Speed Up')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('information tooltip should contain the correct text if editGasMode is cancel', async () => {
|
||||||
|
await act(async () => render());
|
||||||
|
expect(
|
||||||
|
InfoTooltip.mock.calls[0][0].contentText.props.children[0],
|
||||||
|
).toStrictEqual(
|
||||||
|
'To Cancel a transaction the gas fee must be increased by at least 10% for it to be recognized by the network.',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('information tooltip should contain the correct text if editGasMode is speedup', async () => {
|
||||||
|
await act(async () => render({ editGasMode: EDIT_GAS_MODES.SPEED_UP }));
|
||||||
|
expect(
|
||||||
|
InfoTooltip.mock.calls[0][0].contentText.props.children[0],
|
||||||
|
).toStrictEqual(
|
||||||
|
'To Speed Up a transaction the gas fee must be increased by at least 10% for it to be recognized by the network.',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should show correct gas values, increased by 10%, when initial initial gas value is above estimated medium', async () => {
|
it('should show correct gas values, increased by 10%, when initial initial gas value is above estimated medium', async () => {
|
||||||
await act(async () =>
|
await act(async () =>
|
||||||
render(
|
render(
|
||||||
|
Loading…
Reference in New Issue
Block a user