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

Add messages for MetaMetrics opt-in (#9283)

* Add messages for MetaMetrics opt-in
This commit is contained in:
Erik Marks 2020-08-20 17:13:14 -07:00 committed by GitHub
parent f656d3236e
commit e08a55c8bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 8 deletions

View File

@ -3,6 +3,9 @@
"message": "I have read and agree to the $1", "message": "I have read and agree to the $1",
"description": "$1 is the `terms` message" "description": "$1 is the `terms` message"
}, },
"affirmAgree": {
"message": "I Agree"
},
"eth_accounts": { "eth_accounts": {
"message": "View the addresses of your permitted accounts (required)", "message": "View the addresses of your permitted accounts (required)",
"description": "The description for the `eth_accounts` permission" "description": "The description for the `eth_accounts` permission"

View File

@ -58,7 +58,7 @@ describe('MetaMask', function () {
await driver.delay(largeDelayMs) await driver.delay(largeDelayMs)
}) })
it('clicks the "I agree" option on the metametrics opt-in screen', async function () { it('clicks the "I Agree" option on the metametrics opt-in screen', async function () {
await driver.clickElement(By.css('.btn-primary')) await driver.clickElement(By.css('.btn-primary'))
await driver.delay(largeDelayMs) await driver.delay(largeDelayMs)
}) })

View File

@ -11,10 +11,11 @@ export default class MetaMetricsOptInModal extends Component {
static contextTypes = { static contextTypes = {
metricsEvent: PropTypes.func, metricsEvent: PropTypes.func,
t: PropTypes.func,
} }
render () { render () {
const { metricsEvent } = this.context const { metricsEvent, t } = this.context
const { setParticipateInMetaMetrics, hideModal } = this.props const { setParticipateInMetaMetrics, hideModal } = this.props
return ( return (
@ -103,7 +104,7 @@ export default class MetaMetricsOptInModal extends Component {
hideModal() hideModal()
}) })
}} }}
cancelText="No Thanks" cancelText={t('noThanks')}
hideCancel={false} hideCancel={false}
onSubmit={() => { onSubmit={() => {
setParticipateInMetaMetrics(true) setParticipateInMetaMetrics(true)
@ -119,7 +120,7 @@ export default class MetaMetricsOptInModal extends Component {
hideModal() hideModal()
}) })
}} }}
submitText="I agree" submitText={t('affirmAgree')}
submitButtonType="confirm" submitButtonType="confirm"
disabled={false} disabled={false}
/> />

View File

@ -3,6 +3,7 @@ import React from 'react'
import sinon from 'sinon' import sinon from 'sinon'
import { mount } from 'enzyme' import { mount } from 'enzyme'
import MetaMetricsOptIn from '..' import MetaMetricsOptIn from '..'
import messages from '../../../../../../../app/_locales/en/messages.json'
describe('MetaMetrics Opt In', function () { describe('MetaMetrics Opt In', function () {
let wrapper let wrapper
@ -18,6 +19,7 @@ describe('MetaMetrics Opt In', function () {
<MetaMetricsOptIn.WrappedComponent {...props} />, { <MetaMetricsOptIn.WrappedComponent {...props} />, {
context: { context: {
metricsEvent: () => undefined, metricsEvent: () => undefined,
t: (key) => messages[key].message,
}, },
}, },
) )
@ -41,8 +43,8 @@ describe('MetaMetrics Opt In', function () {
}) })
it('passes true to setParticipateInMetaMetrics and hides modal', function (done) { it('passes true to setParticipateInMetaMetrics and hides modal', function (done) {
const iAgree = wrapper.find('.btn-primary.page-container__footer-button') const affirmAgree = wrapper.find('.btn-primary.page-container__footer-button')
iAgree.simulate('click') affirmAgree.simulate('click')
setImmediate(() => { setImmediate(() => {
assert(props.setParticipateInMetaMetrics.calledOnce) assert(props.setParticipateInMetaMetrics.calledOnce)

View File

@ -105,7 +105,7 @@ export default class MetaMetricsOptIn extends Component {
}) })
}) })
}} }}
cancelText="No Thanks" cancelText={t('noThanks')}
hideCancel={false} hideCancel={false}
onSubmit={() => { onSubmit={() => {
setParticipateInMetaMetrics(true) setParticipateInMetaMetrics(true)
@ -138,7 +138,7 @@ export default class MetaMetricsOptIn extends Component {
}) })
}) })
}} }}
submitText="I agree" submitText={t('affirmAgree')}
submitButtonType="primary" submitButtonType="primary"
disabled={false} disabled={false}
/> />