From 5a278555ad36b52ca78ec5403589d213a953652f Mon Sep 17 00:00:00 2001
From: yasharAyari
Date: Wed, 28 Mar 2018 12:34:22 +0200
Subject: [PATCH 1/2] Enable second passphrase item in setting
---
src/components/mainMenu/mainMenu.js | 2 +-
src/components/setting/setting.js | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/components/mainMenu/mainMenu.js b/src/components/mainMenu/mainMenu.js
index 8753919e1a..43ecba42bd 100644
--- a/src/components/mainMenu/mainMenu.js
+++ b/src/components/mainMenu/mainMenu.js
@@ -153,7 +153,7 @@ class MainMenu extends React.Component {
/>)}
-
+
diff --git a/src/components/setting/setting.js b/src/components/setting/setting.js
index 9739a4b755..d94c0b6a70 100644
--- a/src/components/setting/setting.js
+++ b/src/components/setting/setting.js
@@ -1,13 +1,13 @@
import React from 'react';
-// import { Link } from 'react-router-dom';
+import { Link } from 'react-router-dom';
import ReactSwipe from 'react-swipe';
import styles from './setting.css';
import Checkbox from '../toolbox/sliderCheckbox';
import i18n from '../../i18n';
import accountConfig from '../../constants/account';
// TODO: will be re-enabled when the functionality is updated
-// import routes from '../../constants/routes';
-// import { FontIcon } from '../fontIcon';
+import routes from '../../constants/routes';
+import { FontIcon } from '../fontIcon';
// import languageSwitcherTheme from './languageSwitcher.css';
class Setting extends React.Component {
@@ -45,7 +45,7 @@ class Setting extends React.Component {
render() {
this.language = (i18n.language === 'de');
const showSetting = this.props.showSetting ? styles.active : '';
- const { t, settings, settingsUpdated } = this.props;
+ const { t, settings, settingsUpdated, hasSecondPassphrase, toggleMenu } = this.props;
return
- {/* TODO: will be re-enabled when the functionality is updated
{!hasSecondPassphrase ?
+ to={`${routes.main.path}${routes.secondPassphrase.path}`}
+ onClick={toggleMenu}>
{t('Add')}
:
{t('Register 2nd passphrase')}
+ {/* TODO: will be re-enabled when the functionality is updated
- {[...Array(2)].map((x, i) =>
+ {[...Array(3)].map((x, i) =>
-
Date: Wed, 28 Mar 2018 16:36:16 +0200
Subject: [PATCH 2/2] Fix a bug in setting unit test
---
src/components/setting/setting.test.js | 36 +++++++++++++++-----------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/src/components/setting/setting.test.js b/src/components/setting/setting.test.js
index 20ddd208df..146c4b1915 100644
--- a/src/components/setting/setting.test.js
+++ b/src/components/setting/setting.test.js
@@ -4,6 +4,7 @@ import { mount } from 'enzyme';
import sinon from 'sinon';
import configureMockStore from 'redux-mock-store';
import PropTypes from 'prop-types';
+import { MemoryRouter as Router } from 'react-router-dom';
import Setting from './setting';
import accounts from '../../../test/constants/accounts';
import i18n from '../../i18n';
@@ -46,23 +47,22 @@ describe('Setting', () => {
const t = key => key;
let wrapper;
- let settingsUpdated;
- let accountUpdated;
+ const settingsUpdated = sinon.spy();
+ const accountUpdated = sinon.spy();
+ const props = {
+ settingsUpdated,
+ accountUpdated,
+ settings,
+ t,
+ toggleMenu: sinon.spy(),
+ };
beforeEach(() => {
- settingsUpdated = sinon.spy();
- accountUpdated = sinon.spy();
- const props = {
- settingsUpdated,
- accountUpdated,
- settings,
- t,
- };
-
- wrapper = mount(
+ wrapper = mount(
, options);
+ {...props}/>
+ , options);
clock = sinon.useFakeTimers({
toFake: ['setTimeout', 'clearTimeout', 'Date', 'setInterval'],
@@ -112,8 +112,14 @@ describe('Setting', () => {
const settingsToExpireTime = { ...settings };
settingsToExpireTime.autoLog = false;
accountToExpireTime.passphrase = accounts.genesis.passphrase;
- wrapper.setProps({ account: accountToExpireTime, settings: settingsToExpireTime });
- wrapper.update();
+ wrapper = mount(
+
+ , options);
wrapper.find('.autoLog').at(0).find('input').simulate('change', { target: { checked: true, value: true } });
clock.tick(300);