UI component updates (#4010)
* Update blockStatus & test results * IdentityIcon rendering tests for #3950 * Update IdentityName with external messages * Expand to cover basic layout sections * ConfirmDialog rendering tests * TxHash expansion & tests * Cleanup ui/*.spec.js PropType warnings * Use react-intl plural for confirmation/confirmations (verified manually)
This commit is contained in:
@@ -15,13 +15,23 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
|
||||
import { isNullAddress } from '~/util/validation';
|
||||
import ShortenedHash from '../ShortenedHash';
|
||||
|
||||
const defaultName = 'UNNAMED';
|
||||
const defaultName = (
|
||||
<FormattedMessage
|
||||
id='ui.identityName.unnamed'
|
||||
defaultMessage='UNNAMED' />
|
||||
);
|
||||
const defaultNameNull = (
|
||||
<FormattedMessage
|
||||
id='ui.identityName.null'
|
||||
defaultMessage='NULL' />
|
||||
);
|
||||
|
||||
class IdentityName extends Component {
|
||||
static propTypes = {
|
||||
@@ -43,7 +53,7 @@ class IdentityName extends Component {
|
||||
return null;
|
||||
}
|
||||
|
||||
const nullName = isNullAddress(address) ? 'null' : null;
|
||||
const nullName = isNullAddress(address) ? defaultNameNull : null;
|
||||
const addressFallback = nullName || (shorten ? (<ShortenedHash data={ address } />) : address);
|
||||
const fallback = unknown ? defaultName : addressFallback;
|
||||
const isUuid = account && account.name === account.uuid;
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
|
||||
import sinon from 'sinon';
|
||||
|
||||
import IdentityName from './identityName';
|
||||
@@ -44,9 +46,11 @@ const STORE = {
|
||||
|
||||
function render (props) {
|
||||
return mount(
|
||||
<IdentityName
|
||||
store={ STORE }
|
||||
{ ...props } />
|
||||
<IntlProvider locale='en'>
|
||||
<IdentityName
|
||||
store={ STORE }
|
||||
{ ...props } />
|
||||
</IntlProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,7 +78,7 @@ describe('ui/IdentityName', () => {
|
||||
});
|
||||
|
||||
it('renders 0x000...000 as null', () => {
|
||||
expect(render({ address: ADDR_NULL }).text()).to.equal('null');
|
||||
expect(render({ address: ADDR_NULL }).text()).to.equal('NULL');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user