Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### TL;DR Enhanced unit parsing functionality and added comprehensive tests for the `parseUnit` function. ### What changed? - Updated the regular expression in `parseUnit` function to handle more edge cases, including numbers with leading decimal points. - Added extensive unit tests for the `parseUnit` function to cover various scenarios. - Included an additional test case for `iSizeToSize` function to handle zero input. ### How to test? 1. Run the updated test suite for the `parseUnit` function. 2. Verify that all new test cases pass, including: - Parsing numbers with different units (px, em, %) - Parsing numbers without units - Handling invalid inputs - Edge cases like '0', '0px', and '.5em' 3. Check that the `iSizeToSize` function correctly handles zero input. ### Why make this change? This change improves the robustness of the `parseUnit` function, ensuring it can handle a wider range of inputs correctly. The additional tests provide better coverage and confidence in the function's behavior, making the codebase more reliable and easier to maintain.
- Loading branch information