Skip to content

[Color 4] JS API specs#1949

Merged
nex3 merged 52 commits intosass:feature.color-4from
oddbird:js-api-color-4
Nov 17, 2023
Merged

[Color 4] JS API specs#1949
nex3 merged 52 commits intosass:feature.color-4from
oddbird:js-api-color-4

Conversation

@jamesnw
Copy link
Contributor

@jamesnw jamesnw commented Oct 13, 2023

@jgerigmeyer
Copy link
Contributor

@jgerigmeyer

This comment was marked as resolved.

@jamesnw
Copy link
Contributor Author

jamesnw commented Oct 20, 2023

I'd prefer to have all of the looping through the declarations outside test cases, so each test case still ends up testing only one thing.

I made this change in some places, but didn't do it for things like loops through channels. As is, I went from 580 cases to 1800+, but there may be other places where specificity is worth it.

@jamesnw jamesnw marked this pull request as ready for review November 2, 2023 18:13
@jamesnw jamesnw requested a review from nex3 November 2, 2023 18:13
Copy link
Contributor

@nex3 nex3 left a comment

Choose a reason for hiding this comment

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

Just a few style changes and I think we're ready to go!

Comment on lines +1742 to +1758
// Space conversions in ColorJS are close but not precise enough to match
skipForImpl('sass-embedded', () => {
describe('toSpace', () => {
spaceNames.forEach(destinationSpaceId => {
it(`converts pink to ${destinationSpaceId}`, () => {
const destinationSpace = spaces[destinationSpaceId];
const res = color.toSpace(destinationSpace.name);
expect(res.space).toBe(destinationSpace.name);

const expected = destinationSpace.constructor(
...destinationSpace.pink
);
expect(res).toEqualWithHash(expected);
});
});
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

@nex3 Using ColorJS to do color conversions works, but the math isn't precise enough to pass these tests, e.g.:

expected color(xyz-d50 0.66406985168935 0.5367266828656 0.43459579340121) to be .equal() to color(xyz-d50 0.6640698533004 0.53672666252811 0.43459582467203)

I'm not sure if we want to relax the precision requirements, or have different precision requirements for different platforms, or...?

Copy link
Contributor

Choose a reason for hiding this comment

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

Resolved in d5d18b6

@jgerigmeyer jgerigmeyer requested a review from nex3 November 8, 2023 17:01
@nex3 nex3 merged commit 7c45b0b into sass:feature.color-4 Nov 17, 2023
@jgerigmeyer jgerigmeyer deleted the js-api-color-4 branch November 18, 2023 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants