mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
2f50e9fd72
* restore and enhance the time est feature background: we had a feature for showing a time estimate on pending txs that was accidently removed during the redesign implementation. This PR restores that feature and also enhances it: 1. Displays the time estimate on all views instead of just fullscreen 2. Uses Intl.RelativeTimeFormat to format the time 3. Adds a way to toggle the feature flag. 4. Uses a hook to calculate the time remaining instead of a component * Update app/_locales/en/messages.json Co-authored-by: Mark Stacey <markjstacey@gmail.com> * do not display on test nets Co-authored-by: Mark Stacey <markjstacey@gmail.com>
59 lines
1.7 KiB
JavaScript
59 lines
1.7 KiB
JavaScript
import React from 'react'
|
|
import assert from 'assert'
|
|
import sinon from 'sinon'
|
|
import { shallow } from 'enzyme'
|
|
import AdvancedTab from '../advanced-tab.component'
|
|
import TextField from '../../../../components/ui/text-field'
|
|
|
|
describe('AdvancedTab Component', function () {
|
|
it('should render correctly when threeBoxFeatureFlag', function () {
|
|
const root = shallow(
|
|
<AdvancedTab
|
|
ipfsGateway=""
|
|
setAutoLockTimeLimit={() => {}}
|
|
setIpfsGateway={() => {}}
|
|
setShowFiatConversionOnTestnetsPreference={() => {}}
|
|
setThreeBoxSyncingPermission={() => {}}
|
|
threeBoxDisabled
|
|
threeBoxSyncingAllowed={false}
|
|
/>,
|
|
{
|
|
context: {
|
|
t: (s) => `_${s}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
assert.equal(root.find('.settings-page__content-row').length, 11)
|
|
})
|
|
|
|
it('should update autoLockTimeLimit', function () {
|
|
const setAutoLockTimeLimitSpy = sinon.spy()
|
|
const root = shallow(
|
|
<AdvancedTab
|
|
ipfsGateway=""
|
|
setAutoLockTimeLimit={setAutoLockTimeLimitSpy}
|
|
setIpfsGateway={() => {}}
|
|
setShowFiatConversionOnTestnetsPreference={() => {}}
|
|
setThreeBoxSyncingPermission={() => {}}
|
|
threeBoxDisabled
|
|
threeBoxSyncingAllowed={false}
|
|
/>,
|
|
{
|
|
context: {
|
|
t: (s) => `_${s}`,
|
|
},
|
|
}
|
|
)
|
|
|
|
const autoTimeout = root.find('.settings-page__content-row').at(8)
|
|
const textField = autoTimeout.find(TextField)
|
|
|
|
textField.props().onChange({ target: { value: 1440 } })
|
|
assert.equal(root.state().autoLockTimeLimit, 1440)
|
|
|
|
autoTimeout.find('.settings-tab__rpc-save-button').simulate('click')
|
|
assert.equal(setAutoLockTimeLimitSpy.args[0][0], 1440)
|
|
})
|
|
})
|