diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js index ce13ef0ca..2f50e3e88 100644 --- a/app/scripts/lib/auto-reload.js +++ b/app/scripts/lib/auto-reload.js @@ -14,7 +14,7 @@ export default function setupDappAutoReload (web3, observable) { lastTimeUsed = Date.now() // show warning once on web3 access if (!hasBeenWarned && key !== 'currentProvider') { - console.warn(`MetaMask: We will soon stop injecting web3. For more information, see: https://medium.com/metamask/no-longer-injecting-web3-js-4a899ad6e59e`) + console.warn(`MetaMask: We will stop injecting web3 in Q4 2020.\nPlease see this article for more information: https://medium.com/metamask/no-longer-injecting-web3-js-4a899ad6e59e`) hasBeenWarned = true } // return value normally diff --git a/app/scripts/lib/decrypt-message-manager.js b/app/scripts/lib/decrypt-message-manager.js index 94f88d12d..6345dbf57 100644 --- a/app/scripts/lib/decrypt-message-manager.js +++ b/app/scripts/lib/decrypt-message-manager.js @@ -82,7 +82,7 @@ export default class DecryptMessageManager extends EventEmitter { addUnapprovedMessageAsync (msgParams, req) { return new Promise((resolve, reject) => { if (!msgParams.from) { - reject(new Error('MetaMask Decryption: from field is required.')) + return reject(new Error('MetaMask Decryption: from field is required.')) } const msgId = this.addUnapprovedMessage(msgParams, req) this.once(`${msgId}:finished`, (data) => { diff --git a/app/scripts/lib/encryption-public-key-manager.js b/app/scripts/lib/encryption-public-key-manager.js index f568c62db..92f09057c 100644 --- a/app/scripts/lib/encryption-public-key-manager.js +++ b/app/scripts/lib/encryption-public-key-manager.js @@ -79,7 +79,7 @@ export default class EncryptionPublicKeyManager extends EventEmitter { addUnapprovedMessageAsync (address, req) { return new Promise((resolve, reject) => { if (!address) { - reject(new Error('MetaMask Message: address field is required.')) + return reject(new Error('MetaMask Message: address field is required.')) } const msgId = this.addUnapprovedMessage(address, req) this.once(`${msgId}:finished`, (data) => { diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js index 1050abefd..7d603a583 100644 --- a/app/scripts/lib/personal-message-manager.js +++ b/app/scripts/lib/personal-message-manager.js @@ -85,7 +85,7 @@ export default class PersonalMessageManager extends EventEmitter { addUnapprovedMessageAsync (msgParams, req) { return new Promise((resolve, reject) => { if (!msgParams.from) { - reject(new Error('MetaMask Message Signature: from field is required.')) + return reject(new Error('MetaMask Message Signature: from field is required.')) } const msgId = this.addUnapprovedMessage(msgParams, req) this.once(`${msgId}:finished`, (data) => { diff --git a/package.json b/package.json index bb21eeb8f..a3d50701c 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "@metamask/eth-ledger-bridge-keyring": "^0.2.6", "@metamask/eth-token-tracker": "^2.0.0", "@metamask/etherscan-link": "^1.1.0", - "@metamask/inpage-provider": "^5.0.0", + "@metamask/inpage-provider": "^5.2.0", "@popperjs/core": "^2.4.0", "@reduxjs/toolkit": "^1.3.2", "@sentry/browser": "^5.11.1", @@ -189,7 +189,7 @@ "@babel/register": "^7.5.5", "@metamask/eslint-config": "^1.1.0", "@metamask/forwarder": "^1.1.0", - "@metamask/test-dapp": "^1.0.1", + "@metamask/test-dapp": "^2.1.1", "@sentry/cli": "^1.49.0", "@storybook/addon-actions": "^5.3.14", "@storybook/addon-backgrounds": "^5.3.14", diff --git a/ui/app/components/app/asset-list-item/asset-list-item.js b/ui/app/components/app/asset-list-item/asset-list-item.js index 3737698d1..bacae2d3a 100644 --- a/ui/app/components/app/asset-list-item/asset-list-item.js +++ b/ui/app/components/app/asset-list-item/asset-list-item.js @@ -97,7 +97,7 @@ const AssetListItem = ({ data-testid={dataTestId} title={primary} titleIcon={titleIcon} - subtitle={

{secondary}

} + subtitle={

{secondary}

} onClick={onClick} icon={( - + {subtitle} diff --git a/ui/app/components/ui/export-text-container/export-text-container.component.js b/ui/app/components/ui/export-text-container/export-text-container.component.js index 61d15a99d..21a8179a2 100644 --- a/ui/app/components/ui/export-text-container/export-text-container.component.js +++ b/ui/app/components/ui/export-text-container/export-text-container.component.js @@ -2,6 +2,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import copyToClipboard from 'copy-to-clipboard' import { exportAsFile } from '../../../helpers/utils/util' +import Copy from '../icon/copy-icon.component' class ExportTextContainer extends Component { render () { @@ -20,7 +21,7 @@ class ExportTextContainer extends Component { className="export-text-container__button export-text-container__button--copy" onClick={() => copyToClipboard(text)} > - +
{t('copyToClipboard')}
diff --git a/ui/app/components/ui/list-item/list-item.component.js b/ui/app/components/ui/list-item/list-item.component.js index 7481d45db..11a722d7c 100644 --- a/ui/app/components/ui/list-item/list-item.component.js +++ b/ui/app/components/ui/list-item/list-item.component.js @@ -23,7 +23,7 @@ export default function ListItem ({ {icon} )} -
+

{ title }

{titleIcon && (
diff --git a/ui/app/components/ui/list-item/tests/list-item.test.js b/ui/app/components/ui/list-item/tests/list-item.test.js new file mode 100644 index 000000000..fdd0c587c --- /dev/null +++ b/ui/app/components/ui/list-item/tests/list-item.test.js @@ -0,0 +1,75 @@ +import { shallow } from 'enzyme' +import React from 'react' +import ListItem from '../list-item.component' +import assert from 'assert' +import Sinon from 'sinon' +import Preloader from '../../icon/preloader/preloader-icon.component' +import Send from '../../icon/send-icon.component' + +const TITLE = 'Hello World' +const SUBTITLE =

I am a list item

+const CLASSNAME = 'list-item-test' +const RIGHT_CONTENT =

Content rendered to the right

+const CHILDREN = +const MID_CONTENT =

Content rendered in the middle

+ +describe('ListItem', function () { + let wrapper + let clickHandler + before(function () { + clickHandler = Sinon.fake() + wrapper = shallow( + } + titleIcon={} + onClick={clickHandler} + > + {CHILDREN} + + ) + }) + it('includes the data-testid', function () { + assert.equal(wrapper.props()['data-testid'], 'test-id') + }) + it(`renders "${TITLE}" title`, function () { + assert.equal(wrapper.find('.list-item__heading h2').text(), TITLE) + }) + it('adds html title to heading element', function () { + assert.equal(wrapper.find('.list-item__heading').props().title, TITLE) + }) + it(`renders "I am a list item" subtitle`, function () { + assert.equal(wrapper.find('.list-item__subheading').text(), 'I am a list item') + }) + it('attaches external className', function () { + assert(wrapper.props().className.includes(CLASSNAME)) + }) + it('renders content on the right side of the list item', function () { + assert.equal(wrapper.find('.list-item__right-content p').text(), 'Content rendered to the right') + }) + it('renders content in the middle of the list item', function () { + assert.equal(wrapper.find('.list-item__mid-content p').text(), 'Content rendered in the middle') + }) + it('renders list item actions', function () { + assert.equal(wrapper.find('.list-item__actions button').text(), 'I am a button') + }) + it('renders the title icon', function () { + assert(wrapper.find(Preloader)) + }) + it('renders the list item icon', function () { + assert(wrapper.find(Send)) + }) + it('handles click action and fires onClick', function () { + wrapper.simulate('click') + assert.equal(clickHandler.callCount, 1) + }) + + after(function () { + Sinon.restore() + }) +}) diff --git a/ui/app/css/itcss/components/modal.scss b/ui/app/css/itcss/components/modal.scss index a0b74bc8a..f6f4ff093 100644 --- a/ui/app/css/itcss/components/modal.scss +++ b/ui/app/css/itcss/components/modal.scss @@ -216,7 +216,6 @@ overflow: hidden; resize: none; padding: 9px 13px 8px; - text-transform: uppercase; } .modal-close-x::after { diff --git a/ui/app/css/itcss/components/request-decrypt-message.scss b/ui/app/css/itcss/components/request-decrypt-message.scss index 66acefa0c..3d6ad7a61 100644 --- a/ui/app/css/itcss/components/request-decrypt-message.scss +++ b/ui/app/css/itcss/components/request-decrypt-message.scss @@ -173,12 +173,12 @@ padding: 5px; border-radius: 5px; position: relative; - + &-text { font-size: 0.7em; height: 115px; } - + &-cover { background-color: white; opacity: 0.75; @@ -187,7 +187,7 @@ width: 100%; top: 0px; } - + &-lock { position: absolute; height: 100%; @@ -202,12 +202,12 @@ top: calc(50% - 34px); border-radius: 3px; } - + &--pressed { display: none; } } - + &-lock-text { width: 200px; font-size: 0.75em; @@ -219,7 +219,7 @@ line-height: 1em; border-radius: 3px; } - + &-copy { justify-content: space-evenly; font-size: 0.75em; @@ -228,12 +228,12 @@ display: flex; cursor: pointer; } - + &-copy-text { margin-right: 10px; display: inline; } - + &-copy-tooltip { float: right; } @@ -258,7 +258,7 @@ margin-right: 1.2rem; } } - + &__visual { display: flex; flex-direction: row; diff --git a/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js b/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js index 3f82c39c4..a95e6d4cd 100644 --- a/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js +++ b/ui/app/pages/confirm-decrypt-message/confirm-decrypt-message.component.js @@ -7,6 +7,7 @@ import AccountListItem from '../send/account-list-item/account-list-item.compone import Button from '../../components/ui/button' import Identicon from '../../components/ui/identicon' import Tooltip from '../../components/ui/tooltip-v2' +import Copy from '../../components/ui/icon/copy-icon.component' import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums' import { getEnvironmentType } from '../../../../app/scripts/lib/util' @@ -267,13 +268,14 @@ export default class ConfirmDecryptMessage extends Component { position="bottom" title={hasCopied ? t('copiedExclamation') : t('copyToClipboard')} wrapperClassName="request-decrypt-message__message-copy-tooltip" + style={{ display: 'flex', alignItems: 'center' }} >
{t('decryptCopy')}
- +
) diff --git a/ui/app/pages/mobile-sync/mobile-sync.container.js b/ui/app/pages/mobile-sync/mobile-sync.container.js index da83ba013..28c306b1b 100644 --- a/ui/app/pages/mobile-sync/mobile-sync.container.js +++ b/ui/app/pages/mobile-sync/mobile-sync.container.js @@ -19,7 +19,7 @@ const mapStateToProps = (state) => { } = state return { - mostRecentOverviewpage: getMostRecentOverviewPage(state), + mostRecentOverviewPage: getMostRecentOverviewPage(state), selectedAddress, } } diff --git a/yarn.lock b/yarn.lock index a5e596ec8..1df0848f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1696,10 +1696,10 @@ resolved "https://registry.yarnpkg.com/@metamask/forwarder/-/forwarder-1.1.0.tgz#13829d8244bbf19ea658c0b20d21a77b67de0bdd" integrity sha512-Hggj4y0QIjDzKGTXzarhEPIQyFSB2bi2y6YLJNwaT4JmP30UB5Cj6gqoY0M4pj3QT57fzp0BUuGp7F/AUe28tw== -"@metamask/inpage-provider@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@metamask/inpage-provider/-/inpage-provider-5.0.0.tgz#f3961ceb02821255785fe20b1b676bfd944532d7" - integrity sha512-DjQy/hJPKwEhk+L/XPHfR6bSTWsGGXjHCQ3Q/LgieQX/Kv91yyMu+QUu+tWuVi0qX0dSRmaTnFNCF9FWNV1XgA== +"@metamask/inpage-provider@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@metamask/inpage-provider/-/inpage-provider-5.2.0.tgz#a288d473e7374b1b227ea70d888e258854378c28" + integrity sha512-KyMfHcu3LqgxqS2hsxUxfIDjBQRJwOwhK6wOxOtAIRQLz4+Rns0Xt5R/Nk//U/JEskrHnNadTBgWOFCp3YzgJQ== dependencies: eth-json-rpc-errors "^2.0.2" fast-deep-equal "^2.0.1" @@ -1711,19 +1711,10 @@ pump "^3.0.0" safe-event-emitter "^1.0.1" -"@metamask/onboarding@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@metamask/onboarding/-/onboarding-0.2.1.tgz#76e864634d6436a486fcfa743f09a25b1934a11e" - integrity sha512-wSwgkIfVHM6IWja0xfNbK+wMFweOazNe1Z1RVqS0ZKG5v8vCPT93N5IQF2mKCDD+RnBpremE1VYslPPQxQz25g== - dependencies: - bowser "^2.5.4" - -"@metamask/test-dapp@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@metamask/test-dapp/-/test-dapp-1.0.1.tgz#67961a53640faca827422fd7bc467d5b2ceb0292" - integrity sha512-RANP75a5UpCXYydaxZQ6p+4A9UjEg6YC5XS6dGatohtIKbGvN3TAU0wPot3GKcxfn9BbnGKMzQ8DIxmkrEaqSg== - dependencies: - "@metamask/onboarding" "^0.2.1" +"@metamask/test-dapp@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@metamask/test-dapp/-/test-dapp-2.1.1.tgz#c3b79f93c8a698b0904171c5143d0bca1307653a" + integrity sha512-ed0Ma9TLc+wkQYJK5TWslphp58JSi4Rer84LK2RxW1p4aS2LsGKS30pKMFUegj+g9g//7tyh+uFE87pXu4vPkA== "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" @@ -5451,11 +5442,6 @@ borc@^2.1.0: iso-url "~0.4.4" json-text-sequence "~0.1.0" -bowser@^2.5.4: - version "2.7.0" - resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.7.0.tgz#96eab1fa07fab08c1ec4c75977a7c8ddf8e0fe1f" - integrity sha512-aIlMvstvu8x+34KEiOHD3AsBgdrzg6sxALYiukOWhFvGMbQI6TRP/iY0LMhUrHs56aD6P1G0Z7h45PUJaa5m9w== - boxen@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b"