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

Adds CSS Color Module 4 colors and hsl(a) #74

Merged
merged 1 commit into from
Feb 3, 2019

Conversation

bennypowers
Copy link
Contributor

fixes #48

@bennypowers bennypowers force-pushed the patch-1 branch 5 times, most recently from 90bd379 to 7513dd1 Compare February 2, 2019 21:38
@bennypowers bennypowers changed the title Adds all CSS color module 4 colors Adds CSS Color Module 4 colors and hsl(a) Feb 2, 2019
@fatfisz
Copy link
Contributor

fatfisz commented Feb 2, 2019

Great work! Would you be willing to modify it a bit - because having a big switch statement like that is unwieldy - by adding a script similar to the ones existing in scripts/? The output would be a JSON file with an array containing all the scraped colors (the source being https://www.w3.org/TR/css-color-4/ if I'm not mistaken).

@bennypowers
Copy link
Contributor Author

Well i already scraped the colours (and I don't think colors module 4 will change) , so do you want me to just create that file in lib/named_colors.json?

@bennypowers
Copy link
Contributor Author

Ok @fatfisz see if latest changes suit your liking

@fatfisz
Copy link
Contributor

fatfisz commented Feb 3, 2019

Ok, let's go with that. I'll need to adapt the parser anyway because of var(), but it will be better done as a separate change, because rgb and rgba will be affected too.

@fatfisz fatfisz merged commit e591b1b into jsdom:master Feb 3, 2019
@bennypowers
Copy link
Contributor Author

Awesome. Please advise when released, since they're waiting on this in GoogleChrome/lighthouse#7139

@fatfisz
Copy link
Contributor

fatfisz commented Feb 3, 2019

Sure. I just became a contributor to add some stuff that I need at work (and help with some tidying up), so I'm driven to get the new release out quickly :) Expect it under a week or so.

@bennypowers bennypowers deleted the patch-1 branch February 3, 2019 00:41
@bennypowers
Copy link
Contributor Author

👋 Just a friendly bump. any chance we can cut a release?

@fatfisz
Copy link
Contributor

fatfisz commented Feb 15, 2019

Hi, I did what I could, now we're waiting for the release (I don't have permissions). Thanks for your patience, this should be released soon!

@jsakas
Copy link
Member

jsakas commented Feb 16, 2019

@bennypowers @fatfisz v1.2.0 is published to npm.

Thanks for your help!

wardpeet pushed a commit to gatsbyjs/gatsby that referenced this pull request Mar 27, 2019
## Description

Certain CSS styles have been failing to appear in Jest tests due to an outdated JSDom(and some it's dependencies, one being updated with bugfix in Feb 2019). This was causing false positives for `gatsby-image` tests for a while.

Nothing major, just some CSS props weren't appearing in tests when they technically should have been.

## Details

[My PR](#12468) is failing in the CI but was passing tests locally.

I had been running tests on the `gatsby-image` package on it's own, which uses `react-testing-library: ^5.0.0`, and it failed against the snapshot test. Updated snapshots failed when my PR ran on CircleCI. The main repo root yarn.lock file has `react-testing-library: ^5.2.1` locked down(retrieves 5.2.1 instead of 5.9.0, although is a v6 release now). 

Correcting this didn't help for passing the test suite. [`cssstyle: 1.2.0`](jsdom/cssstyle#74) fixes the [problems with certain styles](jsdom/jsdom#1965 (comment)) being [ignored](testing-library/react-testing-library#214. `transitionDelay`, and certain color values for `backgroundColor`, "red" works, but not "lightgray"). That however [needs `jsdom: ^12.0.0`](jsdom/jsdom@ed11465#diff-b9cfc7f2cdf78a7f4b91a753d10865a2), but [Jest refuses to update as support for Node <8 is dropped](jestjs/jest#8016 (comment))..

I've added a workaround until Jest supports a newer major version of JSDom. Using [`jest-environment-jsdom-fourteen`](https://github.com/ianschmitz/jest-environment-jsdom-fourteen) is the [advised approach](jestjs/jest#7122 (comment)) for the meantime, it'll only impact users running Jest test suite on Node 6, that should be fine for Gatsby? (Node 6 CI test seems to pass)

Only `gatsby-image` tests needed updates. [Node 6 will be EoL in May](https://github.com/nodejs/Release#release-schedule), no idea when Jest will bump JSDom from then, but we could wait a few months if you rather avoid the workaround?

## Related Issues

#12468 (Spotted it while working on this)
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.

Colors are not interpreted correctly
3 participants