1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 20:57:12 +01:00
metamask-extension/test/unit/ui/app/reducers/metamask.test.js

428 lines
9.2 KiB
JavaScript
Raw Normal View History

import assert from 'assert';
import reduceMetamask from '../../../../../ui/app/ducks/metamask/metamask';
import * as actionConstants from '../../../../../ui/app/store/actionConstants';
2018-10-10 10:12:46 +02:00
describe('MetaMask Reducers', function () {
it('init state', function () {
const initState = reduceMetamask(undefined, {});
assert(initState);
});
2018-10-10 10:12:46 +02:00
it('locks MetaMask', function () {
const unlockMetaMaskState = {
isUnlocked: true,
selectedAddress: 'test address',
};
2018-10-10 10:12:46 +02:00
const lockMetaMask = reduceMetamask(unlockMetaMaskState, {
type: actionConstants.LOCK_METAMASK,
});
2018-10-10 10:12:46 +02:00
assert.equal(lockMetaMask.isUnlocked, false);
});
2018-10-10 10:12:46 +02:00
it('sets rpc target', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.SET_RPC_TARGET,
value: 'https://custom.rpc',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.provider.rpcUrl, 'https://custom.rpc');
});
2018-10-10 10:12:46 +02:00
it('sets provider type', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.SET_PROVIDER_TYPE,
value: 'provider type',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.provider.type, 'provider type');
});
2018-10-10 10:12:46 +02:00
it('shows account detail', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.SHOW_ACCOUNT_DETAIL,
value: 'test address',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.isUnlocked, true);
assert.equal(state.isInitialized, true);
assert.equal(state.selectedAddress, 'test address');
});
2018-10-10 10:12:46 +02:00
it('sets account label', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.SET_ACCOUNT_LABEL,
value: {
account: 'test account',
label: 'test label',
},
2018-10-10 10:12:46 +02:00
},
);
2018-10-10 10:12:46 +02:00
2020-11-03 00:41:28 +01:00
assert.deepEqual(state.identities, {
'test account': { name: 'test label' },
});
});
2018-10-10 10:12:46 +02:00
it('sets current fiat', function () {
2018-10-10 10:12:46 +02:00
const value = {
currentCurrency: 'yen',
conversionRate: 3.14,
conversionDate: new Date(2018, 9),
};
2018-10-10 10:12:46 +02:00
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.SET_CURRENT_FIAT,
value,
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.currentCurrency, value.currentCurrency);
assert.equal(state.conversionRate, value.conversionRate);
assert.equal(state.conversionDate, value.conversionDate);
});
2018-10-10 10:12:46 +02:00
it('updates tokens', function () {
2018-10-10 10:12:46 +02:00
const newTokens = {
2020-11-03 00:41:28 +01:00
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
decimals: 18,
symbol: 'META',
};
2018-10-10 10:12:46 +02:00
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_TOKENS,
newTokens,
},
);
2018-10-10 10:12:46 +02:00
assert.deepEqual(state.tokens, newTokens);
});
2018-10-10 10:12:46 +02:00
it('updates send gas limit', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_GAS_LIMIT,
value: '0xGasLimit',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.gasLimit, '0xGasLimit');
});
2018-10-10 10:12:46 +02:00
it('updates send gas price', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_GAS_PRICE,
value: '0xGasPrice',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.gasPrice, '0xGasPrice');
});
2018-10-10 10:12:46 +02:00
it('toggles account menu ', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.TOGGLE_ACCOUNT_MENU,
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.isAccountMenuOpen, true);
});
2018-10-10 10:12:46 +02:00
it('updates gas total', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_GAS_TOTAL,
value: '0xGasTotal',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.gasTotal, '0xGasTotal');
});
2018-10-10 10:12:46 +02:00
it('updates send token balance', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_SEND_TOKEN_BALANCE,
value: '0xTokenBalance',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.tokenBalance, '0xTokenBalance');
});
2018-10-10 10:12:46 +02:00
it('updates data', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_SEND_HEX_DATA,
value: '0xData',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.data, '0xData');
});
2018-10-10 10:12:46 +02:00
it('updates send to', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_SEND_TO,
value: {
to: '0xAddress',
nickname: 'nickname',
},
2018-10-10 10:12:46 +02:00
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.to, '0xAddress');
assert.equal(state.send.toNickname, 'nickname');
});
2018-10-10 10:12:46 +02:00
it('update send amount', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_SEND_AMOUNT,
value: '0xAmount',
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.amount, '0xAmount');
});
2018-10-10 10:12:46 +02:00
it('updates max mode', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_MAX_MODE,
value: true,
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.send.maxModeOn, true);
});
2018-10-10 10:12:46 +02:00
it('update send', function () {
2018-10-10 10:12:46 +02:00
const value = {
gasLimit: '0xGasLimit',
gasPrice: '0xGasPrice',
gasTotal: '0xGasTotal',
tokenBalance: '0xBalance',
from: '0xAddress',
to: '0xAddress',
toNickname: '',
maxModeOn: false,
amount: '0xAmount',
memo: '0xMemo',
errors: {},
editingTransactionId: 22,
Address book send plus contact list (#6914) * Style Send Header * Move Send to-row to send view and restyle * Add "Recents" group to select recipient view * Rename SendToRow to AddRecipient * Basic UI and Layout * New ENSInput component * wip - fuzzy search for input * small refactor * Add Dialog * contact list initial * initial error on invalid address * clean up edit * Click to open modal * Create AddToAddressBookModal component * Modal styling and layout * modal i18n * Add to Addressbook * ens wip * ens wip * ENS Resolution * Reset input * Send to explicit address * Happy Path Complete * Add back error checking * Reset send-to when emptying input * Add back warning object * Fix linter * Fix unit test #1 - fix import paths * Remove dead tests * One more to go * Fix all unit tests * add unit test for reducers and actions * test rendering AddRecipient * Add tests for dialog boxes in AddRecipient * Add test for validating * Fix linter * Fix e2e tests * Token send e2e fix * Style View Contact * Style edit-contact * Fix e2e * Fix from-import-beta-ui e2e spec * Make section header say "add recipient” by default * Auto-focus add recipient input * Update placeholder text * Update input title font size * Auto advance to next step if user paste a valid address * Ellipsify address when recipient is selected * Fix app header background color on desktop * Give each form row a margin of 16px * Use .container/.component naming pattern for ens-input * Auto-focus on input when add to addressbook modal is opened; Save on Enter * Fix and add unit test * Fix selectors name in e2e tests * Correct e2e test token amount for address-book-send changes * Adds e2e test for editing a transaction * Delete test/integration/lib/send-new-ui.js * Add tests for amount max button and high value error on send screen to test/e2e/metamask-ui.spec.js * lint and revert to address as object keys * add chainId based on current network to address book entry * fix test * only display contacts for the current network * Improve ENS message when not found on current network * Add error to indicate when network does not support ENS * bump gaba * address book, resolve comments * Move contact-list to its own component * De-duplicate getaddressbook selector and refactor name selection logic in contact-list-tab/ * Use contact-list component in contact-list-tab.component (i.e. in settings) * Improve/fix settings headers for popup and browser views * Lint fixes related to address book updates * Add 'My accounts' page to settings address book * Update add new contact button in settings to match floating circular design * Improve styles of view contact page * Improve styles and labels of the add-contact.component * Further lint fixes related to address book updates * Update unit tests as per address book updates * Ensure that contact list groups are sorted alphabetically * Refactor settings component to use a container for connection to redux; allow display of addressbook name in settings header * Decouple ens-input.component from send context * Add ens resolution to add contact screen in settings * Switching networks when an ens address is shown on send form removes the ens address. * Resolve send screen search for ensAddress to matching address book entry if it exists * Show resolved ens icon and address if exists (settings: add-contact.component) * Make the displayed and copied address in view-contact.component the checksummed address * Default alias state prop in AddToAddressBookModal to empty string * Use keyCode to detect enter key in AddToAddressBookModal * Ensure add-contact component properly updates after QR code detection * Fix display of all recents after clicking 'Load More' in contact list * Fix send screen contact searching after network switching * Code cleanup related to address book changes * Update unit tests for address book changes * Update ENS name not found on network message * Add ens registration error message * Cancel on edit mode takes user back to view screen * Adds support for memo to settings contact list view and edit screens * Modify designs of edit and view contact in popup environment * Update settings content list UX to show split columns in fullscreen and proper internal navigation * Correct background address book API usages in UI
2019-07-31 21:56:44 +02:00
ensResolution: null,
ensResolutionError: '',
};
2018-10-10 10:12:46 +02:00
2020-11-03 00:41:28 +01:00
const sendState = reduceMetamask(
{},
{
type: actionConstants.UPDATE_SEND,
value,
},
);
2018-10-10 10:12:46 +02:00
assert.deepEqual(sendState.send, value);
});
2018-10-10 10:12:46 +02:00
it('clears send', function () {
const initStateSend = {
2020-11-03 00:41:28 +01:00
send: {
gasLimit: null,
gasPrice: null,
gasTotal: null,
tokenBalance: null,
from: '',
to: '',
amount: '0x0',
memo: '',
errors: {},
maxModeOn: false,
editingTransactionId: null,
toNickname: '',
},
};
const sendState = {
send: {
gasLimit: '0xGasLimit',
gasPrice: '0xGasPrice',
gasTotal: '0xGasTotal',
tokenBalance: '0xBalance',
from: '0xAddress',
to: '0xAddress',
toNickname: '',
maxModeOn: false,
amount: '0xAmount',
memo: '0xMemo',
errors: {},
editingTransactionId: 22,
},
};
2018-10-10 10:12:46 +02:00
const state = reduceMetamask(sendState, {
type: actionConstants.CLEAR_SEND,
});
assert.deepEqual(state.send, initStateSend.send);
});
2018-10-10 10:12:46 +02:00
it('updates value of tx by id', function () {
2018-10-10 10:12:46 +02:00
const oldState = {
currentNetworkTxList: [
{
id: 1,
txParams: 'foo',
},
],
};
2018-10-10 10:12:46 +02:00
const state = reduceMetamask(oldState, {
type: actionConstants.UPDATE_TRANSACTION_PARAMS,
2018-10-10 10:12:46 +02:00
id: 1,
value: 'bar',
});
2018-10-10 10:12:46 +02:00
assert.equal(state.currentNetworkTxList[0].txParams, 'bar');
});
2018-10-10 10:12:46 +02:00
it('sets blockies', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.SET_USE_BLOCKIE,
value: true,
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.useBlockie, true);
});
2018-10-10 10:12:46 +02:00
it('updates an arbitrary feature flag', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_FEATURE_FLAGS,
value: {
foo: true,
},
2018-10-10 10:12:46 +02:00
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.featureFlags.foo, true);
});
2018-10-10 10:12:46 +02:00
it('close welcome screen', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.CLOSE_WELCOME_SCREEN,
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.welcomeScreenSeen, true);
});
2018-10-10 10:12:46 +02:00
it('sets current locale', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.SET_CURRENT_LOCALE,
value: { locale: 'ge' },
},
);
2018-10-10 10:12:46 +02:00
assert.equal(state.currentLocale, 'ge');
});
2018-10-10 10:12:46 +02:00
it('sets pending tokens ', function () {
2018-10-10 10:12:46 +02:00
const payload = {
2020-11-03 00:41:28 +01:00
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
decimals: 18,
symbol: 'META',
};
2018-10-10 10:12:46 +02:00
2020-11-03 00:41:28 +01:00
const pendingTokensState = reduceMetamask(
{},
{
type: actionConstants.SET_PENDING_TOKENS,
payload,
},
);
2018-10-10 10:12:46 +02:00
assert.deepEqual(pendingTokensState.pendingTokens, payload);
});
2018-10-10 10:12:46 +02:00
it('clears pending tokens', function () {
const payload = {
2020-11-03 00:41:28 +01:00
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
decimals: 18,
symbol: 'META',
};
const pendingTokensState = {
pendingTokens: payload,
};
2018-10-10 10:12:46 +02:00
const state = reduceMetamask(pendingTokensState, {
type: actionConstants.CLEAR_PENDING_TOKENS,
});
2018-10-10 10:12:46 +02:00
assert.deepEqual(state.pendingTokens, {});
});
Address book send plus contact list (#6914) * Style Send Header * Move Send to-row to send view and restyle * Add "Recents" group to select recipient view * Rename SendToRow to AddRecipient * Basic UI and Layout * New ENSInput component * wip - fuzzy search for input * small refactor * Add Dialog * contact list initial * initial error on invalid address * clean up edit * Click to open modal * Create AddToAddressBookModal component * Modal styling and layout * modal i18n * Add to Addressbook * ens wip * ens wip * ENS Resolution * Reset input * Send to explicit address * Happy Path Complete * Add back error checking * Reset send-to when emptying input * Add back warning object * Fix linter * Fix unit test #1 - fix import paths * Remove dead tests * One more to go * Fix all unit tests * add unit test for reducers and actions * test rendering AddRecipient * Add tests for dialog boxes in AddRecipient * Add test for validating * Fix linter * Fix e2e tests * Token send e2e fix * Style View Contact * Style edit-contact * Fix e2e * Fix from-import-beta-ui e2e spec * Make section header say "add recipient” by default * Auto-focus add recipient input * Update placeholder text * Update input title font size * Auto advance to next step if user paste a valid address * Ellipsify address when recipient is selected * Fix app header background color on desktop * Give each form row a margin of 16px * Use .container/.component naming pattern for ens-input * Auto-focus on input when add to addressbook modal is opened; Save on Enter * Fix and add unit test * Fix selectors name in e2e tests * Correct e2e test token amount for address-book-send changes * Adds e2e test for editing a transaction * Delete test/integration/lib/send-new-ui.js * Add tests for amount max button and high value error on send screen to test/e2e/metamask-ui.spec.js * lint and revert to address as object keys * add chainId based on current network to address book entry * fix test * only display contacts for the current network * Improve ENS message when not found on current network * Add error to indicate when network does not support ENS * bump gaba * address book, resolve comments * Move contact-list to its own component * De-duplicate getaddressbook selector and refactor name selection logic in contact-list-tab/ * Use contact-list component in contact-list-tab.component (i.e. in settings) * Improve/fix settings headers for popup and browser views * Lint fixes related to address book updates * Add 'My accounts' page to settings address book * Update add new contact button in settings to match floating circular design * Improve styles of view contact page * Improve styles and labels of the add-contact.component * Further lint fixes related to address book updates * Update unit tests as per address book updates * Ensure that contact list groups are sorted alphabetically * Refactor settings component to use a container for connection to redux; allow display of addressbook name in settings header * Decouple ens-input.component from send context * Add ens resolution to add contact screen in settings * Switching networks when an ens address is shown on send form removes the ens address. * Resolve send screen search for ensAddress to matching address book entry if it exists * Show resolved ens icon and address if exists (settings: add-contact.component) * Make the displayed and copied address in view-contact.component the checksummed address * Default alias state prop in AddToAddressBookModal to empty string * Use keyCode to detect enter key in AddToAddressBookModal * Ensure add-contact component properly updates after QR code detection * Fix display of all recents after clicking 'Load More' in contact list * Fix send screen contact searching after network switching * Code cleanup related to address book changes * Update unit tests for address book changes * Update ENS name not found on network message * Add ens registration error message * Cancel on edit mode takes user back to view screen * Adds support for memo to settings contact list view and edit screens * Modify designs of edit and view contact in popup environment * Update settings content list UX to show split columns in fullscreen and proper internal navigation * Correct background address book API usages in UI
2019-07-31 21:56:44 +02:00
it('update ensResolution', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_SEND_ENS_RESOLUTION,
payload: '0x1337',
},
);
Address book send plus contact list (#6914) * Style Send Header * Move Send to-row to send view and restyle * Add "Recents" group to select recipient view * Rename SendToRow to AddRecipient * Basic UI and Layout * New ENSInput component * wip - fuzzy search for input * small refactor * Add Dialog * contact list initial * initial error on invalid address * clean up edit * Click to open modal * Create AddToAddressBookModal component * Modal styling and layout * modal i18n * Add to Addressbook * ens wip * ens wip * ENS Resolution * Reset input * Send to explicit address * Happy Path Complete * Add back error checking * Reset send-to when emptying input * Add back warning object * Fix linter * Fix unit test #1 - fix import paths * Remove dead tests * One more to go * Fix all unit tests * add unit test for reducers and actions * test rendering AddRecipient * Add tests for dialog boxes in AddRecipient * Add test for validating * Fix linter * Fix e2e tests * Token send e2e fix * Style View Contact * Style edit-contact * Fix e2e * Fix from-import-beta-ui e2e spec * Make section header say "add recipient” by default * Auto-focus add recipient input * Update placeholder text * Update input title font size * Auto advance to next step if user paste a valid address * Ellipsify address when recipient is selected * Fix app header background color on desktop * Give each form row a margin of 16px * Use .container/.component naming pattern for ens-input * Auto-focus on input when add to addressbook modal is opened; Save on Enter * Fix and add unit test * Fix selectors name in e2e tests * Correct e2e test token amount for address-book-send changes * Adds e2e test for editing a transaction * Delete test/integration/lib/send-new-ui.js * Add tests for amount max button and high value error on send screen to test/e2e/metamask-ui.spec.js * lint and revert to address as object keys * add chainId based on current network to address book entry * fix test * only display contacts for the current network * Improve ENS message when not found on current network * Add error to indicate when network does not support ENS * bump gaba * address book, resolve comments * Move contact-list to its own component * De-duplicate getaddressbook selector and refactor name selection logic in contact-list-tab/ * Use contact-list component in contact-list-tab.component (i.e. in settings) * Improve/fix settings headers for popup and browser views * Lint fixes related to address book updates * Add 'My accounts' page to settings address book * Update add new contact button in settings to match floating circular design * Improve styles of view contact page * Improve styles and labels of the add-contact.component * Further lint fixes related to address book updates * Update unit tests as per address book updates * Ensure that contact list groups are sorted alphabetically * Refactor settings component to use a container for connection to redux; allow display of addressbook name in settings header * Decouple ens-input.component from send context * Add ens resolution to add contact screen in settings * Switching networks when an ens address is shown on send form removes the ens address. * Resolve send screen search for ensAddress to matching address book entry if it exists * Show resolved ens icon and address if exists (settings: add-contact.component) * Make the displayed and copied address in view-contact.component the checksummed address * Default alias state prop in AddToAddressBookModal to empty string * Use keyCode to detect enter key in AddToAddressBookModal * Ensure add-contact component properly updates after QR code detection * Fix display of all recents after clicking 'Load More' in contact list * Fix send screen contact searching after network switching * Code cleanup related to address book changes * Update unit tests for address book changes * Update ENS name not found on network message * Add ens registration error message * Cancel on edit mode takes user back to view screen * Adds support for memo to settings contact list view and edit screens * Modify designs of edit and view contact in popup environment * Update settings content list UX to show split columns in fullscreen and proper internal navigation * Correct background address book API usages in UI
2019-07-31 21:56:44 +02:00
assert.deepEqual(state.send.ensResolution, '0x1337');
assert.deepEqual(state.send.ensResolutionError, '');
});
Address book send plus contact list (#6914) * Style Send Header * Move Send to-row to send view and restyle * Add "Recents" group to select recipient view * Rename SendToRow to AddRecipient * Basic UI and Layout * New ENSInput component * wip - fuzzy search for input * small refactor * Add Dialog * contact list initial * initial error on invalid address * clean up edit * Click to open modal * Create AddToAddressBookModal component * Modal styling and layout * modal i18n * Add to Addressbook * ens wip * ens wip * ENS Resolution * Reset input * Send to explicit address * Happy Path Complete * Add back error checking * Reset send-to when emptying input * Add back warning object * Fix linter * Fix unit test #1 - fix import paths * Remove dead tests * One more to go * Fix all unit tests * add unit test for reducers and actions * test rendering AddRecipient * Add tests for dialog boxes in AddRecipient * Add test for validating * Fix linter * Fix e2e tests * Token send e2e fix * Style View Contact * Style edit-contact * Fix e2e * Fix from-import-beta-ui e2e spec * Make section header say "add recipient” by default * Auto-focus add recipient input * Update placeholder text * Update input title font size * Auto advance to next step if user paste a valid address * Ellipsify address when recipient is selected * Fix app header background color on desktop * Give each form row a margin of 16px * Use .container/.component naming pattern for ens-input * Auto-focus on input when add to addressbook modal is opened; Save on Enter * Fix and add unit test * Fix selectors name in e2e tests * Correct e2e test token amount for address-book-send changes * Adds e2e test for editing a transaction * Delete test/integration/lib/send-new-ui.js * Add tests for amount max button and high value error on send screen to test/e2e/metamask-ui.spec.js * lint and revert to address as object keys * add chainId based on current network to address book entry * fix test * only display contacts for the current network * Improve ENS message when not found on current network * Add error to indicate when network does not support ENS * bump gaba * address book, resolve comments * Move contact-list to its own component * De-duplicate getaddressbook selector and refactor name selection logic in contact-list-tab/ * Use contact-list component in contact-list-tab.component (i.e. in settings) * Improve/fix settings headers for popup and browser views * Lint fixes related to address book updates * Add 'My accounts' page to settings address book * Update add new contact button in settings to match floating circular design * Improve styles of view contact page * Improve styles and labels of the add-contact.component * Further lint fixes related to address book updates * Update unit tests as per address book updates * Ensure that contact list groups are sorted alphabetically * Refactor settings component to use a container for connection to redux; allow display of addressbook name in settings header * Decouple ens-input.component from send context * Add ens resolution to add contact screen in settings * Switching networks when an ens address is shown on send form removes the ens address. * Resolve send screen search for ensAddress to matching address book entry if it exists * Show resolved ens icon and address if exists (settings: add-contact.component) * Make the displayed and copied address in view-contact.component the checksummed address * Default alias state prop in AddToAddressBookModal to empty string * Use keyCode to detect enter key in AddToAddressBookModal * Ensure add-contact component properly updates after QR code detection * Fix display of all recents after clicking 'Load More' in contact list * Fix send screen contact searching after network switching * Code cleanup related to address book changes * Update unit tests for address book changes * Update ENS name not found on network message * Add ens registration error message * Cancel on edit mode takes user back to view screen * Adds support for memo to settings contact list view and edit screens * Modify designs of edit and view contact in popup environment * Update settings content list UX to show split columns in fullscreen and proper internal navigation * Correct background address book API usages in UI
2019-07-31 21:56:44 +02:00
it('update ensResolutionError', function () {
2020-11-03 00:41:28 +01:00
const state = reduceMetamask(
{},
{
type: actionConstants.UPDATE_SEND_ENS_RESOLUTION_ERROR,
payload: 'ens name not found',
},
);
Address book send plus contact list (#6914) * Style Send Header * Move Send to-row to send view and restyle * Add "Recents" group to select recipient view * Rename SendToRow to AddRecipient * Basic UI and Layout * New ENSInput component * wip - fuzzy search for input * small refactor * Add Dialog * contact list initial * initial error on invalid address * clean up edit * Click to open modal * Create AddToAddressBookModal component * Modal styling and layout * modal i18n * Add to Addressbook * ens wip * ens wip * ENS Resolution * Reset input * Send to explicit address * Happy Path Complete * Add back error checking * Reset send-to when emptying input * Add back warning object * Fix linter * Fix unit test #1 - fix import paths * Remove dead tests * One more to go * Fix all unit tests * add unit test for reducers and actions * test rendering AddRecipient * Add tests for dialog boxes in AddRecipient * Add test for validating * Fix linter * Fix e2e tests * Token send e2e fix * Style View Contact * Style edit-contact * Fix e2e * Fix from-import-beta-ui e2e spec * Make section header say "add recipient” by default * Auto-focus add recipient input * Update placeholder text * Update input title font size * Auto advance to next step if user paste a valid address * Ellipsify address when recipient is selected * Fix app header background color on desktop * Give each form row a margin of 16px * Use .container/.component naming pattern for ens-input * Auto-focus on input when add to addressbook modal is opened; Save on Enter * Fix and add unit test * Fix selectors name in e2e tests * Correct e2e test token amount for address-book-send changes * Adds e2e test for editing a transaction * Delete test/integration/lib/send-new-ui.js * Add tests for amount max button and high value error on send screen to test/e2e/metamask-ui.spec.js * lint and revert to address as object keys * add chainId based on current network to address book entry * fix test * only display contacts for the current network * Improve ENS message when not found on current network * Add error to indicate when network does not support ENS * bump gaba * address book, resolve comments * Move contact-list to its own component * De-duplicate getaddressbook selector and refactor name selection logic in contact-list-tab/ * Use contact-list component in contact-list-tab.component (i.e. in settings) * Improve/fix settings headers for popup and browser views * Lint fixes related to address book updates * Add 'My accounts' page to settings address book * Update add new contact button in settings to match floating circular design * Improve styles of view contact page * Improve styles and labels of the add-contact.component * Further lint fixes related to address book updates * Update unit tests as per address book updates * Ensure that contact list groups are sorted alphabetically * Refactor settings component to use a container for connection to redux; allow display of addressbook name in settings header * Decouple ens-input.component from send context * Add ens resolution to add contact screen in settings * Switching networks when an ens address is shown on send form removes the ens address. * Resolve send screen search for ensAddress to matching address book entry if it exists * Show resolved ens icon and address if exists (settings: add-contact.component) * Make the displayed and copied address in view-contact.component the checksummed address * Default alias state prop in AddToAddressBookModal to empty string * Use keyCode to detect enter key in AddToAddressBookModal * Ensure add-contact component properly updates after QR code detection * Fix display of all recents after clicking 'Load More' in contact list * Fix send screen contact searching after network switching * Code cleanup related to address book changes * Update unit tests for address book changes * Update ENS name not found on network message * Add ens registration error message * Cancel on edit mode takes user back to view screen * Adds support for memo to settings contact list view and edit screens * Modify designs of edit and view contact in popup environment * Update settings content list UX to show split columns in fullscreen and proper internal navigation * Correct background address book API usages in UI
2019-07-31 21:56:44 +02:00
assert.deepEqual(state.send.ensResolutionError, 'ens name not found');
assert.deepEqual(state.send.ensResolution, null);
});
});