-
-
Notifications
You must be signed in to change notification settings - Fork 83
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 parsing 7 character hex colors successfully #616
Fix parsing 7 character hex colors successfully #616
Conversation
Fix parsing color strings in hexadecimal notation with 7 character successfully. This is caused by the sRGB color space's tex test regexp allowing a match of 3 valid characters followed by a match of 4 valid characters (and vice-versa). The fix is done by separating the regexp for the collpased and non-collapsed forms. Add four tests for invalid hex color strings with invalid lengths. Three of them (those for 2, 5, and 9 characters) pass without this fix. Only the one for 7 characters doesn't already.
✅ Deploy Preview for colorjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@DmitrySharabin could you please investigate if this is an hTest bug? |
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.
The change LGTM, thank you! Someone should run the tests before merging though.
The tests pass |
I pushed a commit to upgrade to the latest version of htest. @kleinfreund can you try running the tests again with the latest version of htest. I'm guessing the tests will still fail but it's worth giving it a shot. |
It turned out that there is a known issue with paths when used in dynamic |
It should be fixed now in the latest version of hTest (v0.0.16). |
I can confirm that running |
Changes
Fix parsing color strings in hexadecimal notation with 7 character successfully. This is caused by the sRGB color space's hex test regexp allowing a match of 3 valid characters followed by a match of 4 valid characters (and vice-versa). The fix is done by separating the regexp for the collapsed and non-collapsed forms.
Add four tests for invalid hex color strings with invalid lengths. Three of them (those for 2, 5, and 9 characters) pass without this fix. Only the one for 7 characters doesn't already.
Notes
Error importing tests from C:\Users\phil\dev\color.js\test\adapt.js: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
error for all test files. In my Ubuntu environment, they work however. It looks like there might be a dynamic import somewhere that is fed with ac:\...
-style path but I couldn't find it in this repository or htest.