From c185bb856136e64f3f3c05daf1ec31aded2cdfa9 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 28 Dec 2016 14:42:58 +0100 Subject: [PATCH 01/38] Add esjify for mocha + ejs --- js/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/package.json b/js/package.json index 242676eb01d..c29f7bd5bd8 100644 --- a/js/package.json +++ b/js/package.json @@ -43,8 +43,8 @@ "lint:css": "stylelint ./src/**/*.css", "lint:js": "eslint --ignore-path .gitignore ./src/", "lint:js:cached": "eslint --cache --ignore-path .gitignore ./src/", - "test": "NODE_ENV=test mocha 'src/**/*.spec.js'", - "test:coverage": "NODE_ENV=test istanbul cover _mocha -- 'src/**/*.spec.js'", + "test": "NODE_ENV=test mocha --compilers ejs:ejsify 'src/**/*.spec.js'", + "test:coverage": "NODE_ENV=test istanbul cover _mocha -- --compilers ejs:ejsify 'src/**/*.spec.js'", "test:e2e": "NODE_ENV=test mocha 'src/**/*.e2e.js'", "test:npm": "(cd .npmjs && npm i) && node test/npmParity && (rm -rf .npmjs/node_modules)", "prepush": "npm run lint:cached" @@ -80,6 +80,7 @@ "coveralls": "2.11.15", "css-loader": "0.26.1", "ejs-loader": "0.3.0", + "ejsify": "1.0.0", "enzyme": "2.6.0", "eslint": "3.11.1", "eslint-config-semistandard": "7.0.0", From 7b8e708e1f5ee40e86f7e303cfd821160681d4d2 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 28 Dec 2016 14:43:41 +0100 Subject: [PATCH 02/38] First pass through, intl + basic smoketests --- .../AccountDetails/accountDetails.js | 41 ++++-- .../AccountDetails/accountDetails.spec.js | 38 ++++++ .../AccountDetailsGeth/accountDetailsGeth.css | 2 +- .../AccountDetailsGeth/accountDetailsGeth.js | 29 ++++- .../accountDetailsGeth.spec.js | 57 ++++++++ .../CreationType/creationType.js | 37 +++++- .../CreationType/creationType.spec.js | 42 ++++++ .../CreateAccount/NewAccount/newAccount.js | 122 ++++++++++++------ .../NewAccount/newAccount.spec.js | 51 ++++++++ .../modals/CreateAccount/NewGeth/newGeth.css | 25 ++-- .../modals/CreateAccount/NewGeth/newGeth.js | 26 ++-- .../CreateAccount/NewGeth/newGeth.spec.js | 42 ++++++ .../CreateAccount/NewImport/newImport.js | 71 +++++++--- .../CreateAccount/NewImport/newImport.spec.js | 42 ++++++ js/src/modals/CreateAccount/RawKey/rawKey.js | 87 +++++++++---- .../CreateAccount/RawKey/rawKey.spec.js | 42 ++++++ .../RecoveryPhrase/recoveryPhrase.js | 93 +++++++++---- .../RecoveryPhrase/recoveryPhrase.spec.js | 42 ++++++ js/src/modals/CreateAccount/createAccount.js | 64 +++++---- .../CreateAccount/createAccount.spec.js | 38 ++++++ .../{recovery-page.ejs => recoveryPage.ejs} | 1 - js/src/ui/Icons/index.js | 6 + 22 files changed, 820 insertions(+), 178 deletions(-) create mode 100644 js/src/modals/CreateAccount/AccountDetails/accountDetails.spec.js create mode 100644 js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.spec.js create mode 100644 js/src/modals/CreateAccount/CreationType/creationType.spec.js create mode 100644 js/src/modals/CreateAccount/NewAccount/newAccount.spec.js create mode 100644 js/src/modals/CreateAccount/NewGeth/newGeth.spec.js create mode 100644 js/src/modals/CreateAccount/NewImport/newImport.spec.js create mode 100644 js/src/modals/CreateAccount/RawKey/rawKey.spec.js create mode 100644 js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.spec.js create mode 100644 js/src/modals/CreateAccount/createAccount.spec.js rename js/src/modals/CreateAccount/{recovery-page.ejs => recoveryPage.ejs} (99%) diff --git a/js/src/modals/CreateAccount/AccountDetails/accountDetails.js b/js/src/modals/CreateAccount/AccountDetails/accountDetails.js index 2ff143b6424..2e67245b448 100644 --- a/js/src/modals/CreateAccount/AccountDetails/accountDetails.js +++ b/js/src/modals/CreateAccount/AccountDetails/accountDetails.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Form, Input, InputAddress } from '~/ui'; @@ -31,15 +32,31 @@ export default class AccountDetails extends Component { return (
+ } + label={ + + } + readOnly value={ name } /> + } + label={ + + } value={ address } /> { this.renderPhrase() } @@ -55,10 +72,18 @@ export default class AccountDetails extends Component { return ( + } + label={ + + } + readOnly value={ phrase } /> ); } diff --git a/js/src/modals/CreateAccount/AccountDetails/accountDetails.spec.js b/js/src/modals/CreateAccount/AccountDetails/accountDetails.spec.js new file mode 100644 index 00000000000..8a33b14d559 --- /dev/null +++ b/js/src/modals/CreateAccount/AccountDetails/accountDetails.spec.js @@ -0,0 +1,38 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; + +import AccountDetails from './'; + +let component; + +function render () { + component = shallow( + + ); + + return component; +} + +describe('modals/CreateAccount/AccountDetails', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); +}); diff --git a/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.css b/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.css index fd4da0710ef..a6f747ae738 100644 --- a/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.css +++ b/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.css @@ -16,7 +16,7 @@ */ .address { color: #999; - padding-top: 1em; line-height: 1.618em; padding-left: 2em; + padding-top: 1em; } diff --git a/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.js b/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.js index 4d9cde568b5..c45d9e0c766 100644 --- a/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.js +++ b/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import styles from './accountDetailsGeth.css'; @@ -26,16 +27,30 @@ export default class AccountDetailsGeth extends Component { render () { const { addresses } = this.props; - const formatted = addresses.map((address, idx) => { - const comma = !idx ? '' : ((idx === addresses.length - 1) ? ' & ' : ', '); - return `${comma}${address}`; - }).join(''); - return (
-
You have imported { addresses.length } addresses from the Geth keystore:
-
{ formatted }
+
+ +
+
+ { this.formatAddresses(addresses) } +
); } + + formatAddresses (addresses) { + return addresses.map((address, index) => { + const comma = !index + ? '' + : ((index === addresses.length - 1) ? ' & ' : ', '); + + return `${comma}${address}`; + }).join(''); + } } diff --git a/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.spec.js b/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.spec.js new file mode 100644 index 00000000000..ab5294caeba --- /dev/null +++ b/js/src/modals/CreateAccount/AccountDetailsGeth/accountDetailsGeth.spec.js @@ -0,0 +1,57 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; + +import AccountDetailsGeth from './'; + +let component; + +function render () { + component = shallow( + + ); + + return component; +} + +describe('modals/CreateAccount/AccountDetailsGeth', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); + + describe('utility', () => { + describe('formatAddresses', () => { + let instance; + + beforeEach(() => { + instance = component.instance(); + }); + + it('renders a single item', () => { + expect(instance.formatAddresses(['one'])).to.equal('one'); + }); + + it('renders multiple items', () => { + expect(instance.formatAddresses(['one', 'two', 'three'])).to.equal('one, two & three'); + }); + }); + }); +}); diff --git a/js/src/modals/CreateAccount/CreationType/creationType.js b/js/src/modals/CreateAccount/CreationType/creationType.js index 3c91c970167..8cd06cf76bc 100644 --- a/js/src/modals/CreateAccount/CreationType/creationType.js +++ b/js/src/modals/CreateAccount/CreationType/creationType.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton'; import styles from '../createAccount.css'; @@ -36,22 +37,46 @@ export default class CreationType extends Component { name='creationType' onChange={ this.onChange }> + } value='fromNew' /> + } value='fromPhrase' /> + } value='fromGeth' /> + } value='fromJSON' /> + } value='fromPresale' /> + } value='fromRaw' /> diff --git a/js/src/modals/CreateAccount/CreationType/creationType.spec.js b/js/src/modals/CreateAccount/CreationType/creationType.spec.js new file mode 100644 index 00000000000..d46821bb952 --- /dev/null +++ b/js/src/modals/CreateAccount/CreationType/creationType.spec.js @@ -0,0 +1,42 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; +import sinon from 'sinon'; + +import CreationType from './'; + +let component; +let onChange; + +function render () { + onChange = sinon.stub(); + component = shallow( + + ); + + return component; +} + +describe('modals/CreateAccount/CreationType', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); +}); diff --git a/js/src/modals/CreateAccount/NewAccount/newAccount.js b/js/src/modals/CreateAccount/NewAccount/newAccount.js index c0bcca91a50..8faf2434f8e 100644 --- a/js/src/modals/CreateAccount/NewAccount/newAccount.js +++ b/js/src/modals/CreateAccount/NewAccount/newAccount.js @@ -15,11 +15,12 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import IconButton from 'material-ui/IconButton'; import { RadioButton, RadioButtonGroup } from 'material-ui/RadioButton'; -import ActionAutorenew from 'material-ui/svg-icons/action/autorenew'; import { Form, Input, IdentityIcon } from '~/ui'; +import { RefreshIcon } from '~/ui/Icons'; import ERRORS from '../errors'; @@ -60,34 +61,66 @@ export default class CreateAccount extends Component { return (
+ hint={ + + } + label={ + + } + onChange={ this.onEditAccountName } + value={ accountName } /> + hint={ + + } + label={ + + } + onChange={ this.onEditPasswordHint } + value={ passwordHint } />
+ hint={ + + } + label={ + + } + onChange={ this.onEditPassword1 } + type='password' + value={ password1 } />
+ hint={ + + } + label={ + + } + onChange={ this.onEditPassword2 } + type='password' + value={ password2 } />
{ this.renderIdentitySelector() } @@ -103,21 +136,23 @@ export default class CreateAccount extends Component { return null; } - const buttons = Object.keys(accounts).map((address) => { - return ( - - ); - }); + const buttons = Object + .keys(accounts) + .map((address) => { + return ( + + ); + }); return ( + onChange={ this.onChangeIdentity } + valueSelected={ selectedAddress }> { buttons } ); @@ -130,18 +165,20 @@ export default class CreateAccount extends Component { return null; } - const identities = Object.keys(accounts).map((address) => { - return ( -
- -
- ); - }); + const identities = Object + .keys(accounts) + .map((address) => { + return ( +
+ +
+ ); + }); return (
@@ -149,8 +186,7 @@ export default class CreateAccount extends Component {
- +
diff --git a/js/src/modals/CreateAccount/NewAccount/newAccount.spec.js b/js/src/modals/CreateAccount/NewAccount/newAccount.spec.js new file mode 100644 index 00000000000..379031504c9 --- /dev/null +++ b/js/src/modals/CreateAccount/NewAccount/newAccount.spec.js @@ -0,0 +1,51 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; +import sinon from 'sinon'; + +import NewAccount from './'; + +let component; +let onChange; + +function render () { + onChange = sinon.stub(); + component = shallow( + , + { + context: { + api: { + parity: { + generateSecretPhrase: sinon.stub().resolves() + } + } + } + } + ); + + return component; +} + +describe('modals/CreateAccount/NewAccount', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); +}); diff --git a/js/src/modals/CreateAccount/NewGeth/newGeth.css b/js/src/modals/CreateAccount/NewGeth/newGeth.css index 94c143b03c6..69dd439c7b5 100644 --- a/js/src/modals/CreateAccount/NewGeth/newGeth.css +++ b/js/src/modals/CreateAccount/NewGeth/newGeth.css @@ -15,29 +15,30 @@ /* along with Parity. If not, see . */ .list { -} - -.list input+div>div { - top: 13px; + input+div>div { + top: 13px; + } } .selection { display: inline-block; margin-bottom: 0.5em; -} -.selection .icon { - display: inline-block; + .icon { + display: inline-block; + } } .selection .detail { display: inline-block; } -.detail .address { - color: #aaa; -} +.detail { + .address { + color: #aaa; + } -.detail .balance { - font-family: 'Roboto Mono', monospace; + .balance { + font-family: 'Roboto Mono', monospace; + } } diff --git a/js/src/modals/CreateAccount/NewGeth/newGeth.js b/js/src/modals/CreateAccount/NewGeth/newGeth.js index f8cd1fbe692..bbee6d8c6c3 100644 --- a/js/src/modals/CreateAccount/NewGeth/newGeth.js +++ b/js/src/modals/CreateAccount/NewGeth/newGeth.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Checkbox } from 'material-ui'; import { IdentityIcon } from '~/ui'; @@ -44,7 +45,11 @@ export default class NewGeth extends Component { if (!available.length) { return ( -
There are currently no importable keys available from the Geth keystore, which are not already available on your Parity instance
+
+ +
); } @@ -53,22 +58,27 @@ export default class NewGeth extends Component {
+ address={ account.address } + center + inline />
-
{ account.address }
-
{ account.balance } ETH
+
+ { account.address } +
+
+ { account.balance } ETH +
); return ( ); }); @@ -123,7 +133,7 @@ export default class NewGeth extends Component { }); }) .catch((error) => { - console.error('loadAvailable', error); + console.warn('loadAvailable', error); }); } } diff --git a/js/src/modals/CreateAccount/NewGeth/newGeth.spec.js b/js/src/modals/CreateAccount/NewGeth/newGeth.spec.js new file mode 100644 index 00000000000..fc02148dc83 --- /dev/null +++ b/js/src/modals/CreateAccount/NewGeth/newGeth.spec.js @@ -0,0 +1,42 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; +import sinon from 'sinon'; + +import NewGeth from './'; + +let component; +let onChange; + +function render () { + onChange = sinon.stub(); + component = shallow( + + ); + + return component; +} + +describe('modals/CreateAccount/NewGeth', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); +}); diff --git a/js/src/modals/CreateAccount/NewImport/newImport.js b/js/src/modals/CreateAccount/NewImport/newImport.js index 17a1cfd447f..887f2b915b0 100644 --- a/js/src/modals/CreateAccount/NewImport/newImport.js +++ b/js/src/modals/CreateAccount/NewImport/newImport.js @@ -16,10 +16,11 @@ import React, { Component, PropTypes } from 'react'; import ReactDOM from 'react-dom'; +import { FormattedMessage } from 'react-intl'; import { FloatingActionButton } from 'material-ui'; -import EditorAttachFile from 'material-ui/svg-icons/editor/attach-file'; import { Form, Input } from '~/ui'; +import { AttachFileIcon } from '~/ui/Icons'; import ERRORS from '../errors'; @@ -55,45 +56,77 @@ export default class NewImport extends Component { return ( + hint={ + + } + label={ + + } + onChange={ this.onEditAccountName } + value={ this.state.accountName } /> + hint={ + + } + label={ + + } + onChange={ this.onEditpasswordHint } + value={ this.state.passwordHint } />
+ hint={ + + } + label={ + + } + type='password' + onChange={ this.onEditPassword } + value={ this.state.password } />
+ } + label={ + + } value={ this.state.walletFile } />
- + + type='file' />
diff --git a/js/src/modals/CreateAccount/NewImport/newImport.spec.js b/js/src/modals/CreateAccount/NewImport/newImport.spec.js new file mode 100644 index 00000000000..4da1535baa1 --- /dev/null +++ b/js/src/modals/CreateAccount/NewImport/newImport.spec.js @@ -0,0 +1,42 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; +import sinon from 'sinon'; + +import NewImport from './'; + +let component; +let onChange; + +function render () { + onChange = sinon.stub(); + component = shallow( + + ); + + return component; +} + +describe('modals/CreateAccount/NewImport', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); +}); diff --git a/js/src/modals/CreateAccount/RawKey/rawKey.js b/js/src/modals/CreateAccount/RawKey/rawKey.js index f284cf32308..3b9c17dfb71 100644 --- a/js/src/modals/CreateAccount/RawKey/rawKey.js +++ b/js/src/modals/CreateAccount/RawKey/rawKey.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Form, Input } from '~/ui'; @@ -56,40 +57,80 @@ export default class RawKey extends Component { return (
+ hint={ + + } + label={ + + } + onChange={ this.onEditKey } + value={ rawKey } /> + hint={ + + } + label={ + + } + onChange={ this.onEditAccountName } + value={ accountName } /> + hint={ + + } + label={ + + } + onChange={ this.onEditPasswordHint } + value={ passwordHint } />
+ hint={ + + } + label={ + + } + onChange={ this.onEditPassword1 } + type='password' + value={ password1 } />
+ hint={ + + } + label={ + + } + onChange={ this.onEditPassword2 } + type='password' + value={ password2 } />
@@ -119,8 +160,6 @@ export default class RawKey extends Component { const rawKey = event.target.value; let rawKeyError = null; - console.log(rawKey.length, rawKey); - if (!rawKey || !rawKey.trim().length) { rawKeyError = ERRORS.noKey; } else if (rawKey.substr(0, 2) !== '0x' || rawKey.substr(2).length !== 64 || !api.util.isHex(rawKey)) { diff --git a/js/src/modals/CreateAccount/RawKey/rawKey.spec.js b/js/src/modals/CreateAccount/RawKey/rawKey.spec.js new file mode 100644 index 00000000000..ff0290d5b98 --- /dev/null +++ b/js/src/modals/CreateAccount/RawKey/rawKey.spec.js @@ -0,0 +1,42 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; +import sinon from 'sinon'; + +import RawKey from './'; + +let component; +let onChange; + +function render () { + onChange = sinon.stub(); + component = shallow( + + ); + + return component; +} + +describe('modals/CreateAccount/RawKey', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); +}); diff --git a/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js b/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js index fd504302497..267955f2dd2 100644 --- a/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js +++ b/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Checkbox } from 'material-ui'; import { Form, Input } from '~/ui'; @@ -54,44 +55,88 @@ export default class RecoveryPhrase extends Component { return (
+ hint={ + + } + label={ + + } + onChange={ this.onEditPhrase } + value={ recoveryPhrase } /> + hint={ + + } + label={ + + } + onChange={ this.onEditAccountName } + value={ accountName } /> + hint={ + + } + label={ + + } + onChange={ this.onEditPasswordHint } + value={ passwordHint } />
+ hint={ + + } + label={ + + } + onChange={ this.onEditPassword1 } + type='password' + value={ password1 } />
+ hint={ + + } + label={ + + } + onChange={ this.onEditPassword2 } + type='password' + value={ password2 } />
+ } onCheck={ this.onToggleWindowsPhrase } />
diff --git a/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.spec.js b/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.spec.js new file mode 100644 index 00000000000..4d6033755e1 --- /dev/null +++ b/js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.spec.js @@ -0,0 +1,42 @@ +// Copyright 2015, 2016 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import { shallow } from 'enzyme'; +import React from 'react'; +import sinon from 'sinon'; + +import RecoveryPhrase from './'; + +let component; +let onChange; + +function render () { + onChange = sinon.stub(); + component = shallow( + + ); + + return component; +} + +describe('modals/CreateAccount/RecoveryPhrase', () => { + describe('rendering', () => { + it('renders with defaults', () => { + expect(render()).to.be.ok; + }); + }); +}); diff --git a/js/src/modals/CreateAccount/createAccount.js b/js/src/modals/CreateAccount/createAccount.js index 569d374ccd1..a43e62af9ad 100644 --- a/js/src/modals/CreateAccount/createAccount.js +++ b/js/src/modals/CreateAccount/createAccount.js @@ -16,14 +16,9 @@ import React, { Component, PropTypes } from 'react'; import { FormattedMessage } from 'react-intl'; -import ActionDone from 'material-ui/svg-icons/action/done'; -import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; -import ContentClear from 'material-ui/svg-icons/content/clear'; -import NavigationArrowBack from 'material-ui/svg-icons/navigation/arrow-back'; -import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward'; -import PrintIcon from 'material-ui/svg-icons/action/print'; import { Button, Modal, Warning } from '~/ui'; +import { CancelIcon, CheckIcon, DoneIcon, NextIcon, PrevIcon, PrintIcon } from '~/ui/Icons'; import AccountDetails from './AccountDetails'; import AccountDetailsGeth from './AccountDetailsGeth'; @@ -36,14 +31,26 @@ import RecoveryPhrase from './RecoveryPhrase'; import { createIdentityImg } from '~/api/util/identity'; import print from './print'; -import recoveryPage from './recovery-page.ejs'; -import ParityLogo from '../../../assets/images/parity-logo-black-no-text.svg'; +import recoveryPage from './recoveryPage.ejs'; +import ParityLogo from '~/../assets/images/parity-logo-black-no-text.svg'; const TITLES = { - type: 'creation type', - create: 'create account', - info: 'account information', - import: 'import wallet' + type: + , + create: + , + info: + , + import: + }; const STAGE_NAMES = [TITLES.type, TITLES.create, TITLES.info]; const STAGE_IMPORT = [TITLES.type, TITLES.import, TITLES.info]; @@ -153,15 +160,19 @@ export default class CreateAccount extends Component { renderDialogActions () { const { createType, stage } = this.state; + const cancelBtn = ( +