Skip to content

Commit ba11881

Browse files
authored
fix: fix account list item for portfolio view (#28598)
## **Description** Fixes account list item wit Portfolio view feature flag. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28598?quickstart=1) ## **Related issues** Fixes: #28592 ## **Manual testing steps** Make sure you run the steps with AND without the PORTFOLIO_VIEW flag 1. Go to settings => Security and privacy => and disable "Show balance and token price checker" 2. Open account picker make sure you see crypto values 3. Enable the setting again and you should see Fiat values ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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.
1 parent f455a6e commit ba11881

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

test/e2e/tests/settings/account-token-list.spec.js

+37
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,41 @@ describe('Settings', function () {
116116
},
117117
);
118118
});
119+
120+
it('Should show crypto value when price checker setting is off', async function () {
121+
await withFixtures(
122+
{
123+
fixtures: new FixtureBuilder()
124+
.withConversionRateEnabled()
125+
.withShowFiatTestnetEnabled()
126+
.withPreferencesControllerShowNativeTokenAsMainBalanceDisabled()
127+
.withConversionRateDisabled()
128+
.build(),
129+
ganacheOptions: defaultGanacheOptions,
130+
title: this.test.fullTitle(),
131+
testSpecificMock: mockInfuraResponses,
132+
},
133+
async ({ driver }) => {
134+
await unlockWallet(driver);
135+
136+
await driver.clickElement('[data-testid="popover-close"]');
137+
await driver.clickElement(
138+
'[data-testid="account-overview__asset-tab"]',
139+
);
140+
141+
const tokenListAmount = await driver.findElement(
142+
'.eth-overview__primary-container',
143+
);
144+
await driver.delay(1000);
145+
assert.equal(await tokenListAmount.getText(), '25\nETH');
146+
147+
await driver.clickElement('[data-testid="account-menu-icon"]');
148+
const accountTokenValue = await driver.waitForSelector(
149+
'.multichain-account-list-item .multichain-account-list-item__asset',
150+
);
151+
152+
assert.equal(await accountTokenValue.getText(), '25ETH');
153+
},
154+
);
155+
});
119156
});

ui/components/multichain/account-list-item/account-list-item.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const AccountListItem = ({
143143
let balanceToTranslate;
144144
if (isEvmNetwork) {
145145
balanceToTranslate =
146-
shouldShowFiat || isTestnet || !process.env.PORTFOLIO_VIEW
146+
!shouldShowFiat || isTestnet || !process.env.PORTFOLIO_VIEW
147147
? account.balance
148148
: totalFiatBalance;
149149
} else {
@@ -345,7 +345,7 @@ const AccountListItem = ({
345345
type={PRIMARY}
346346
showFiat={showFiat}
347347
isAggregatedFiatOverviewBalance={
348-
!isTestnet && process.env.PORTFOLIO_VIEW
348+
!isTestnet && process.env.PORTFOLIO_VIEW && shouldShowFiat
349349
}
350350
data-testid="first-currency-display"
351351
privacyMode={privacyMode}

0 commit comments

Comments
 (0)