Skip to content

Add check for a ZERO value #104

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

Merged
merged 1 commit into from
May 9, 2021
Merged

Add check for a ZERO value #104

merged 1 commit into from
May 9, 2021

Conversation

Flavsditz
Copy link
Contributor

The JS language considers the value ZERO to be
"false". This has to do with the fact that the
numeric representation of true/false are 1/0.

This was of course preventing the initial value
of a numeric field to be set to zero since there
was a check on the mounted function that saw if
the value was defined.

I've added a simple OR case, where if the value
was evaluated to FALSE than we check again for
if the value is zero. This fixed the case where
the value ZERO was not being shown when it was
deliberately chosen.

It did break another case when we pass an empty
string. To fix it I also test if the original value
is not empty (which would be evaluated to zero)

Make sure to read the contribution guidelines before submitting PR.

The JS language considers the value ZERO to be
"false". This has to do with the fact that the
numeric representation of true/false are 1/0.

This was of course preventing the initial value
of a numeric field to be set to zero since there
was a check on the mounted function that saw if
the value was defined.

I've added a simple OR case, where if the value
was evaluated to FALSE than we check again for
if the value is zero. This fixed the case where
the value ZERO was not being shown when it was
deliberately chosen.

It did break another case when we pass an empty
string. To fix it I also test if the original value
is not empty (which would be evaluated to zero)
@Flavsditz
Copy link
Contributor Author

This PR was raised in order to fix the Issue mentioned in #103

@codecov
Copy link

codecov bot commented May 2, 2021

Codecov Report

Merging #104 (a61caaf) into master (d1ac034) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
+ Coverage   98.00%   98.03%   +0.03%     
==========================================
  Files           1        1              
  Lines          50       51       +1     
  Branches       20       21       +1     
==========================================
+ Hits           49       50       +1     
  Partials        1        1              
Impacted Files Coverage Δ
src/vue-numeric.vue 98.03% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1ac034...a61caaf. Read the comment docs.

@Flavsditz
Copy link
Contributor Author

Anything I might have to do here still? I don't think any update to the docs is necessary...

@kevinongko kevinongko merged commit 6713174 into kevinongko:master May 9, 2021
@kevinongko
Copy link
Owner

thanks, merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants