2019-05-08 20:57:21 +02:00
|
|
|
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'
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('AdvancedTab Component', function () {
|
|
|
|
it('should render correctly when threeBoxFeatureFlag', function () {
|
2019-05-08 20:57:21 +02:00
|
|
|
const root = shallow(
|
2020-01-14 22:15:54 +01:00
|
|
|
<AdvancedTab
|
|
|
|
ipfsGateway=""
|
2020-01-21 23:09:53 +01:00
|
|
|
setAutoLockTimeLimit={() => {}}
|
2020-01-14 22:15:54 +01:00
|
|
|
setIpfsGateway={() => {}}
|
|
|
|
setShowFiatConversionOnTestnetsPreference={() => {}}
|
|
|
|
setThreeBoxSyncingPermission={() => {}}
|
|
|
|
threeBoxDisabled
|
|
|
|
threeBoxSyncingAllowed={false}
|
|
|
|
/>,
|
2019-05-08 20:57:21 +02:00
|
|
|
{
|
|
|
|
context: {
|
2020-02-15 21:34:12 +01:00
|
|
|
t: (s) => `_${s}`,
|
2019-05-08 20:57:21 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2019-12-12 20:28:07 +01:00
|
|
|
assert.equal(root.find('.settings-page__content-row').length, 10)
|
2019-09-16 19:11:01 +02:00
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should update autoLockTimeLimit', function () {
|
2020-01-21 23:09:53 +01:00
|
|
|
const setAutoLockTimeLimitSpy = sinon.spy()
|
2019-05-08 20:57:21 +02:00
|
|
|
const root = shallow(
|
|
|
|
<AdvancedTab
|
2020-01-14 22:15:54 +01:00
|
|
|
ipfsGateway=""
|
2020-01-21 23:09:53 +01:00
|
|
|
setAutoLockTimeLimit={setAutoLockTimeLimitSpy}
|
2020-01-14 22:15:54 +01:00
|
|
|
setIpfsGateway={() => {}}
|
|
|
|
setShowFiatConversionOnTestnetsPreference={() => {}}
|
|
|
|
setThreeBoxSyncingPermission={() => {}}
|
|
|
|
threeBoxDisabled
|
|
|
|
threeBoxSyncingAllowed={false}
|
2019-05-08 20:57:21 +02:00
|
|
|
/>,
|
|
|
|
{
|
|
|
|
context: {
|
2020-02-15 21:34:12 +01:00
|
|
|
t: (s) => `_${s}`,
|
2019-05-08 20:57:21 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2019-09-27 06:30:36 +02:00
|
|
|
const autoTimeout = root.find('.settings-page__content-row').at(7)
|
2019-05-08 20:57:21 +02:00
|
|
|
const textField = autoTimeout.find(TextField)
|
|
|
|
|
|
|
|
textField.props().onChange({ target: { value: 1440 } })
|
2020-01-21 23:09:53 +01:00
|
|
|
assert.equal(root.state().autoLockTimeLimit, 1440)
|
2019-05-08 20:57:21 +02:00
|
|
|
|
2019-10-17 17:25:37 +02:00
|
|
|
autoTimeout.find('.settings-tab__rpc-save-button').simulate('click')
|
2020-01-21 23:09:53 +01:00
|
|
|
assert.equal(setAutoLockTimeLimitSpy.args[0][0], 1440)
|
2019-05-08 20:57:21 +02:00
|
|
|
})
|
|
|
|
})
|