1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Remove bottom space when hiding testnet (#12821)

This commit is contained in:
朱里 2022-01-06 03:04:34 +08:00 committed by GitHub
parent fc185e3139
commit b9093e2a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 22 deletions

View File

@ -3,7 +3,6 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { compose } from 'redux';
import classnames from 'classnames';
import Button from '../../ui/button';
import * as actions from '../../../store/actions';
import { openAlert as displayInvalidCustomNetworkAlert } from '../../../ducks/alerts/invalid-custom-network';
@ -362,21 +361,19 @@ class NetworkDropdown extends Component {
this.props.provider,
)}
<div
className={classnames('network-dropdown-testnets', {
'network-dropdown-testnets--no-visibility': !shouldShowTestNetworks,
})}
>
{this.renderNetworkEntry('ropsten')}
{this.renderNetworkEntry('kovan')}
{this.renderNetworkEntry('rinkeby')}
{this.renderNetworkEntry('goerli')}
{this.renderCustomRpcList(
rpcListDetailForLocalHost,
this.props.provider,
{ isLocalHost: true },
)}
</div>
{shouldShowTestNetworks && (
<>
{this.renderNetworkEntry('ropsten')}
{this.renderNetworkEntry('kovan')}
{this.renderNetworkEntry('rinkeby')}
{this.renderNetworkEntry('goerli')}
{this.renderCustomRpcList(
rpcListDetailForLocalHost,
this.props.provider,
{ isLocalHost: true },
)}
</>
)}
</div>
{this.renderAddCustomButton()}

View File

@ -147,6 +147,10 @@ describe('Network Dropdown', () => {
'addNetwork',
);
});
it('shows test networks in the dropdown', () => {
expect(wrapper.find('.network-dropdown-list li')).toHaveLength(8);
});
});
describe('NetworkDropdown in appState is true and show test networks is false', () => {
@ -193,5 +197,9 @@ describe('Network Dropdown', () => {
'addNetwork',
);
});
it('does not show test networks in the dropdown', () => {
expect(wrapper.find('.network-dropdown-list li')).toHaveLength(3);
});
});
});

View File

@ -141,12 +141,6 @@
background-color: $scorpion;
}
.network-dropdown-testnets {
&--no-visibility {
visibility: hidden;
}
}
.network-dropdown-title {
@include H4;