1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Decrease click area for AmountMaxButton on send screen

This commit is contained in:
Whymarrh Whitby 2018-10-15 20:56:24 -02:30
parent 8c33c018de
commit bdb6e55354
2 changed files with 24 additions and 19 deletions

View File

@ -34,21 +34,27 @@ export default class AmountMaxButton extends Component {
}) })
} }
render () { onMaxClick = (event) => {
const { setMaxModeTo, maxModeOn } = this.props const { setMaxModeTo } = this.props
return ( event.preventDefault()
<div setMaxModeTo(true)
className="send-v2__amount-max" this.setMaxAmount()
onClick={(event) => { }
event.preventDefault()
setMaxModeTo(true) render () {
this.setMaxAmount() return this.props.maxModeOn
}} ? null
> : (
{!maxModeOn ? this.context.t('max') : ''} <div>
</div> <span
) className="send-v2__amount-max"
onClick={this.onMaxClick}
>
{this.context.t('max')}
</span>
</div>
)
} }
} }

View File

@ -56,9 +56,8 @@ describe('AmountMaxButton Component', function () {
}) })
describe('render', () => { describe('render', () => {
it('should render a div with a send-v2__amount-max class', () => { it('should render an element with a send-v2__amount-max class', () => {
assert.equal(wrapper.find('.send-v2__amount-max').length, 1) assert(wrapper.exists('.send-v2__amount-max'))
assert(wrapper.find('.send-v2__amount-max').is('div'))
}) })
it('should call setMaxModeTo and setMaxAmount when the send-v2__amount-max div is clicked', () => { it('should call setMaxModeTo and setMaxAmount when the send-v2__amount-max div is clicked', () => {
@ -77,9 +76,9 @@ describe('AmountMaxButton Component', function () {
) )
}) })
it('should not render text when maxModeOn is true', () => { it('should not render anything when maxModeOn is true', () => {
wrapper.setProps({ maxModeOn: true }) wrapper.setProps({ maxModeOn: true })
assert.equal(wrapper.find('.send-v2__amount-max').text(), '') assert.ok(!wrapper.exists('.send-v2__amount-max'))
}) })
it('should render the expected text when maxModeOn is false', () => { it('should render the expected text when maxModeOn is false', () => {