mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
Fix #19437 - Prevent Connected Sites global menu item from being clicked during confirmation (#19598)
* Fix #19437 - Prevent Connected Sites global menu item from being clicked during confirmation * Add tests
This commit is contained in:
parent
b6f42bacf7
commit
276d9c74c6
@ -77,6 +77,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
<Menu anchorElement={anchorElement} onHide={closeMenu}>
|
||||
<MenuItem
|
||||
iconName={IconName.Connect}
|
||||
disabled={hasUnapprovedTransactions}
|
||||
onClick={() => {
|
||||
history.push(CONNECTED_ROUTE);
|
||||
trackEvent({
|
||||
@ -88,6 +89,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
||||
});
|
||||
closeMenu();
|
||||
}}
|
||||
data-testid="global-menu-connected-sites"
|
||||
>
|
||||
{t('connectedSites')}
|
||||
</MenuItem>
|
||||
|
@ -67,6 +67,20 @@ describe('AccountListItem', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('disables the connected sites item when there is an active transaction', async () => {
|
||||
const { getByTestId } = render();
|
||||
await waitFor(() => {
|
||||
expect(getByTestId('global-menu-connected-sites')).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
it('enables the connected sites item when there is no active transaction', async () => {
|
||||
const { getByTestId } = render({ unapprovedTxs: {} });
|
||||
await waitFor(() => {
|
||||
expect(getByTestId('global-menu-connected-sites')).toBeEnabled();
|
||||
});
|
||||
});
|
||||
|
||||
it('expands metamask to tab when item is clicked', async () => {
|
||||
global.platform = { openExtensionInBrowser: jest.fn() };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user