Skip to content

Commit

Permalink
fix(wallet-overview): prevent send button clicked event to be sent tw…
Browse files Browse the repository at this point in the history
…ice (#28772)

## **Description**

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28772?quickstart=1)

## **Related issues**

Fixes:
-
https://github.com/MetaMask/metamask-extension/pull/28593/files#r1860667737

## **Manual testing steps**

N/A (being covered by unit tests)

## **Screenshots/Recordings**

### **Before**

### **After**

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
ccharly authored Nov 27, 2024
1 parent afe6dc0 commit 803a85d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
13 changes: 0 additions & 13 deletions ui/components/app/wallet-overview/coin-buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,19 +375,6 @@ const CoinButtons = ({
}
///: END:ONLY_INCLUDE_IF
default: {
trackEvent(
{
event: MetaMetricsEventName.NavSendButtonClicked,
category: MetaMetricsEventCategory.Navigation,
properties: {
token_symbol: 'ETH',
location: 'Home',
text: 'Send',
chain_id: chainId,
},
},
{ excludeMetaMetricsId: false },
);
await setCorrectChain();
await dispatch(startNewDraftTransaction({ type: AssetType.native }));
history.push(SEND_ROUTE);
Expand Down
2 changes: 2 additions & 0 deletions ui/components/app/wallet-overview/eth-overview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ describe('EthOverview', () => {
expect(buyButton).not.toBeDisabled();
fireEvent.click(buyButton);

expect(mockTrackEvent).toHaveBeenCalledTimes(1);
expect(mockTrackEvent).toHaveBeenCalledWith({
event: MetaMetricsEventName.NavBuyButtonClicked,
category: MetaMetricsEventCategory.Navigation,
Expand Down Expand Up @@ -539,6 +540,7 @@ describe('EthOverview', () => {
expect(sendButton).not.toBeDisabled();
fireEvent.click(sendButton);

expect(mockTrackEvent).toHaveBeenCalledTimes(1);
expect(mockTrackEvent).toHaveBeenCalledWith(
{
event: MetaMetricsEventName.NavSendButtonClicked,
Expand Down
2 changes: 2 additions & 0 deletions ui/components/app/wallet-overview/non-evm-overview.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ describe('NonEvmOverview', () => {
expect(buyButton).not.toBeDisabled();
fireEvent.click(buyButton as HTMLElement);

expect(mockTrackEvent).toHaveBeenCalledTimes(1);
expect(mockTrackEvent).toHaveBeenCalledWith({
event: MetaMetricsEventName.NavBuyButtonClicked,
category: MetaMetricsEventCategory.Navigation,
Expand Down Expand Up @@ -381,6 +382,7 @@ describe('NonEvmOverview', () => {
expect(sendButton).not.toBeDisabled();
fireEvent.click(sendButton as HTMLElement);

expect(mockTrackEvent).toHaveBeenCalledTimes(1);
expect(mockTrackEvent).toHaveBeenCalledWith(
{
event: MetaMetricsEventName.NavSendButtonClicked,
Expand Down

0 comments on commit 803a85d

Please sign in to comment.