Skip to content
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

Added test for the remaining units #16

Merged
merged 3 commits into from
Jan 30, 2022
Merged

Conversation

AleexCaires
Copy link
Collaborator

Added Latest tests for [remToPt, perToPt, ptToPer, perToPx, pxToPer]

@AleexCaires AleexCaires added the enhancement New feature or request label Jan 30, 2022
@AleexCaires AleexCaires self-assigned this Jan 30, 2022
@Mario-Duarte
Copy link
Owner

I have simplified the test file for useConvertUnits hook and fixed a mistake where the defaultSize referring to the default browser font-size was not taken into account when converting from points to rems and rems to points.

The correct way to find the ratio is to divide the defaultSize by 1.333333333333333, leading to the formula of:

// PT to REM
Math.round(((size * (1.333333333333333/defaultSize)) + Number.EPSILON) * 1000 ) / 1000;

and

// REM to PT
Math.round(((size / (1.333333333333333/defaultSize) ) + Number.EPSILON) * 1000 ) / 1000;

Apart from this, everything is LGTM
👏

Copy link
Owner

@Mario-Duarte Mario-Duarte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few amends and added my comments previusly

@Mario-Duarte Mario-Duarte merged commit df4317e into develop Jan 30, 2022
@Mario-Duarte Mario-Duarte deleted the feat/ui-development branch January 30, 2022 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants