fix(superset-frontend): color formats big numbers when value is 0
SUMMARY
Previously when the value of a BigNumber was zero (falsey) the expression to evaluate colors always got evaluated to false. Meaning that if my condition was number <= 50 and my number was 0, it wouldn't color it. It would work if it was 0.1.
Related to this issue: #21820 Most recent discussion around this PR #23064
TESTING INSTRUCTIONS
- Tested if colors when BigNumber is zero
- Tested if still works for negative, floats, and scientific notation numbers like
1e-100
ADDITIONAL INFORMATION
- [x] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in SIP-59)
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
Thanks for opening this!
@mtrentz thanks for the fix. Would you mind adding unit tests to prevent future regressions?
Hey @john-bodley and @rusackas
I would be happy to contribute with tests but in this case I don't know how.
The logic I've changed is inside the rendering logic and I don't know how to mock render these e-charts. I also could not find any other similar tests that I can use to base myself of when testing this part of the code.