mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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}>
|
<Menu anchorElement={anchorElement} onHide={closeMenu}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
iconName={IconName.Connect}
|
iconName={IconName.Connect}
|
||||||
|
disabled={hasUnapprovedTransactions}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.push(CONNECTED_ROUTE);
|
history.push(CONNECTED_ROUTE);
|
||||||
trackEvent({
|
trackEvent({
|
||||||
@ -88,6 +89,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
|
|||||||
});
|
});
|
||||||
closeMenu();
|
closeMenu();
|
||||||
}}
|
}}
|
||||||
|
data-testid="global-menu-connected-sites"
|
||||||
>
|
>
|
||||||
{t('connectedSites')}
|
{t('connectedSites')}
|
||||||
</MenuItem>
|
</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 () => {
|
it('expands metamask to tab when item is clicked', async () => {
|
||||||
global.platform = { openExtensionInBrowser: jest.fn() };
|
global.platform = { openExtensionInBrowser: jest.fn() };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user