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'
|
|
|
|
|
|
|
|
describe('AdvancedTab Component', () => {
|
2019-09-26 09:24:52 +02:00
|
|
|
it('should render correctly when threeBoxFeatureFlag', () => {
|
2019-05-08 20:57:21 +02:00
|
|
|
const root = shallow(
|
|
|
|
<AdvancedTab />,
|
|
|
|
{
|
|
|
|
context: {
|
|
|
|
t: s => `_${s}`,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2019-09-27 06:30:36 +02:00
|
|
|
assert.equal(root.find('.settings-page__content-row').length, 9)
|
2019-09-16 19:11:01 +02:00
|
|
|
})
|
|
|
|
|
2019-05-08 20:57:21 +02:00
|
|
|
it('should update autoLogoutTimeLimit', () => {
|
|
|
|
const setAutoLogoutTimeLimitSpy = sinon.spy()
|
|
|
|
const root = shallow(
|
|
|
|
<AdvancedTab
|
|
|
|
setAutoLogoutTimeLimit={setAutoLogoutTimeLimitSpy}
|
|
|
|
/>,
|
|
|
|
{
|
|
|
|
context: {
|
|
|
|
t: s => `_${s}`,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
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 } })
|
|
|
|
assert.equal(root.state().autoLogoutTimeLimit, 1440)
|
|
|
|
|
2019-10-17 17:25:37 +02:00
|
|
|
autoTimeout.find('.settings-tab__rpc-save-button').simulate('click')
|
2019-05-08 20:57:21 +02:00
|
|
|
assert.equal(setAutoLogoutTimeLimitSpy.args[0][0], 1440)
|
|
|
|
})
|
|
|
|
})
|