-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Fix) Restrict token mantissa to decimals #631
Conversation
# Conflicts: # src/components/Common/NumericInput.js # src/components/Common/__snapshots__/ReservedTokensInputBlock.spec.js.snap # src/utils/utils.js
…tial (i.e.: 1e-10)
Pull Request Test Coverage Report for Build 1530
💛 - Coveralls |
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.
@fvictorio done, thanks! |
wrapper.find('.reserved-tokens-item-empty').children('a').at(0).simulate('click') | ||
expect(removeCallback).toHaveBeenCalledTimes(1) | ||
}) | ||
// it('Should reset state after adding a new address', () => { |
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.
Can this commented code be removed?
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.
removed
|
||
if (!(firstCharacterIsMinus && acceptsNegativeValues) && isNaN(parseInt(e.key, 10))) e.preventDefault() | ||
if (!acceptFloat && !allowsNegative) { |
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 means that if I create a NumericInput
that allows negatives but not floats, I will be able to input -
and .
, or am I missing something?
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.
ohh, good catch!
I did change how this check is done. It will allow -
symbol to be entered if floats or negative values are allowed. But will prevent any other special char (e
, .
, +
) if float is not allowed.
pristine: true, | ||
valid: INVALID | ||
value: props.value || '', | ||
pristine: props.pristine || true, |
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 means we can't create a NumericInput
initialized with pristine={false}
. Not that we need it, but if that's the case we should do just pristine: true
here.
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.
Modified so it will default to true
only if props.pristine
is undefined
.
thanks!
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.
Some comments, but nothing that blocks merging this in my opinion.
Closes #592
This PR introduces a refactor of
NumericInput
component, due to the restrictions in its previous implementation... it was useless to solve this particular issue.Also, as it was refactored I had to refactor how the
decimals
,minCap
(#571) andcustom gasPrice
(#573) inputs were implemented.Things to consider:
e
is used to represent a number in scientific notation. Thus, when a number can be a float,e
will be enabled.integer
, but it should support as many decimals as the token will supportdecimals
to a lower value, he/she will need to delete the already loaded addresses. Thus, adding a "Bulk Delete" button to the reserved tokens will be helpful.