-
Notifications
You must be signed in to change notification settings - Fork 60
Conversation
@@ -20,7 +21,13 @@ const HeaderElement = props => ( | |||
theme={styles} | |||
> | |||
<MenuItem caption="Register second passphrase" /> | |||
<MenuItem caption="Register as delegate" /> | |||
<MenuItem caption="Register as delegate" | |||
className={(props.account.isDelegate) ? styles.hidden : ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the PR is in progress, but I just noticed this one thing. IMO more elegant way to conditionally hide an element in react is the ternary operator - {shouldShow ? <Element /> : null }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a small component with no reprinting effect, there's no difference. I'll change anyways.
@@ -98,8 +98,10 @@ class LoginFormComponent extends React.Component { | |||
getAccount(this.props.peers.data, accountInfo.address).then((result) => { | |||
onAccountUpdated(result); | |||
getDelegate(this.props.peers.data, accountInfo.publicKey).then((data) => { | |||
console.log('success'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this console.log
onAccountUpdated({ delegate: data.delegate, isDelegate: true }); | ||
}).catch(() => { | ||
console.log('error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this console.log
className='second-secret' | ||
value={this.state.secondSecret} /> | ||
} | ||
<hr/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hr
is not visible due to display:none
from passphrase.css
. passphrase.css
needs to be fixed.
}); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
onAccountUpdated: data => dispatch(accountUpdated(data)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot find where is this used.
src/components/header/header.css
Outdated
@@ -20,3 +20,6 @@ | |||
.menu { | |||
right: -16px !important; | |||
} | |||
.hidden { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.hidden
is not used.
it('should return a dispatch object', () => { | ||
const props = mountedAccount.find(RegisterDelegate).props(); | ||
const data = props.showSuccessAlert('sample text'); | ||
expect(data).to.be.equal(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
it('should return a dispatch object', () => { | ||
const props = mountedAccount.find(RegisterDelegate).props(); | ||
const data = props.showErrorAlert('sample text'); | ||
expect(data).to.be.equal(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
wrapper = mount(<RegisterDelegate {...normalProps} />); | ||
}); | ||
|
||
it('renders an InfoParagraph components', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "components" -> "component"
}, | ||
closeDialog: () => {}, | ||
onAccountUpdated: () => {}, | ||
showSuccessAlert: () => {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make this showSuccessAlert: sinon.spy()
and then expect that it has been called when necessary.
Those tests ending with wrapper.find('.submit-button').simulate('click');
and not checking anything with expect
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that I'm not doing this either (in send.test.js
). I tried to but the spy does not seem to be called.
closeDialog: () => {}, | ||
onAccountUpdated: () => {}, | ||
showSuccessAlert: () => {}, | ||
showErrorAlert: () => {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
}); | ||
|
||
it('does not allow registering an existing username', () => { | ||
delegateApiMock.expects('registerDelegate').resolves({ success: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be rejects
not resolves
}); | ||
|
||
it('does not allow register as delegate for a delegate account', () => { | ||
delegateApiMock.expects('registerDelegate').resolves({ success: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be rejects
not resolves
|
||
wrapper.find('.username input').simulate('change', { target: { value: 'sample_username' } }); | ||
wrapper.find('.submit-button').simulate('click'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case for 'Username already exists' missing
}, | ||
closeDialog: () => {}, | ||
onAccountUpdated: () => {}, | ||
showSuccessAlert: () => {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that I'm not doing this either (in send.test.js
). I tried to but the spy does not seem to be called.
this.props.account.secondSecret && | ||
<Input label='Second secret' required={true} | ||
className='second-secret' | ||
value={this.state.secondSecret} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Input
won't set this.state.secondSecret
without onChange
Now that pending transactions PR is merged this should also dispatch a pending transaction (see how it's used in send send https://github.com/LiskHQ/lisk-nano/blob/development/src/components/send/send.js#L74-L81 ) |
d82b187
to
55ac449
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job
Since Vit is not here and I've done the change requests I could handle
Closes #354