-
Notifications
You must be signed in to change notification settings - Fork 395
fix(NumberInput): add button type and disabled #360
fix(NumberInput): add button type and disabled #360
Conversation
@@ -153,8 +153,13 @@ describe('NumberInput', () => { | |||
); | |||
|
|||
const input = wrapper.find('input'); | |||
const upArrow = wrapper.find('.up-icon'); | |||
const downArrow = wrapper.find('.down-icon'); | |||
const upArrow = wrapper.find('.up-icon').parent(); |
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.
target the element that has the actual event handler
@@ -187,8 +192,8 @@ describe('NumberInput', () => { | |||
); | |||
|
|||
const input = wrapper.find('input'); | |||
const upArrow = wrapper.find('.up-icon').last(); | |||
const downArrow = wrapper.find('.down-icon').last(); | |||
const upArrow = wrapper.find('Icon.up-icon').closest('button'); |
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.
this would use parent as well but there is a bug in enzyme with mount that I opened
disabled | ||
}; | ||
|
||
const createButton = dir => ( |
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.
refactored this so its dry'er
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.
Do we need to do this if it's only at two call sites?
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.
1 < 2 so id say yes. I added 2 new lines of code and reduced the overall file by as much.
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'm less concerned about file size and more concerned about closure allocs. I'm definitely down if the change made things much easier, but since it's so few call sites the change seems unnecessary.
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.
Thanks so much for doing this! Only thing I'm cautious about is the DRY-ness added in for creating the buttons. Would love to hear your thoughts/reasoning behind it 😄
disabled | ||
}; | ||
|
||
const createButton = dir => ( |
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.
Do we need to do this if it's only at two call sites?
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.
Looks good to me once comments are addressed! 👍 ✅
Can we also bump the version of |
the peer is set to |
- Add button type to arrow button to prevent a form from being submitted
when it is clicked
- Disable the arrow buttons when the NumberInput is disabled just in
case
Fixes #358
Add button type to arrow button to prevent a form from being submitted
when it is clicked
Disable the arrow buttons when the NumberInput is disabled just in
case
Fixes #358