-
Notifications
You must be signed in to change notification settings - Fork 88
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
[Color 4] Add tests for color equality with same()
and ==
#1984
Conversation
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.
LGTM, but I have a couple of questions due to my lack of understanding on how hex colors are parsed 😅
@@ -0,0 +1,251 @@ | |||
<===> true/legacy/same_space/rgb/no_none/input.scss | |||
a {b: #abcdef == #abcdef} |
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.
When Sass parses #abc
, does it internally store it as if it parsed #aabbcc
?
Currently #abc == #aabbccff
returns true
, per the spec changes this will now return false
, or no?
And if it now returns false
, is this covered by the false/legacy/same_space/rgb/one_none
test?
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.
All colors are stored as four floating-point numbers (the three color space channels and the alpha channel) as well as the color space name. #abc
, #aabbcc
, #aabbccff
, and rgb(170 187 255)
all share the same internal representation, and so are mutually ==
to one another. We test this in the tests for color parsing and constructor functions; here we can safely assume that the internal representations are the same, and that we only need to verify checks for that expected representation.
@@ -0,0 +1,244 @@ | |||
<===> true/same_space/identical/input.scss | |||
@use 'sass:color'; | |||
a {b: color.same(#abcdef, #abcdef)} |
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.
Out of curiosity, is color.same(#abc, #abcf)
covered by true/same_space/none_and_zero
or by true/different_space/no_none/input
?
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.
#abcf
isn't a color. Do you mean #abcdef
? Those would be different colors, so they'd be under false/
.
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.
I forgot to select "Approve" 😅
[skip dart-sass]