jsdom / cssstyle

A Node.js implementation of the CSS Object Model CSSStyleDeclaration interface
MIT License
105 stars 70 forks source link

linear-gradient in background is parsed as invalid #148

Open magom001 opened 2 years ago

magom001 commented 2 years ago

I noticed that when I try to do snapshot testing on my react components with inline styles, background: linear-gradient(...) is missing from the snapshot.

I described the issue in details on stackoverflow: https://stackoverflow.com/questions/70832768/jest-tomatchsnapshot-removes-inline-styles

I then tracked the issue to this:

In shorthandSetter the shorthandParser returns undefined because parseColor does know how to handle linear-gradient.

magom001 commented 2 years ago

Changing this from return undefined to return val fixes the issue.

subrato-pattanaik commented 2 years ago

Nice find! It seems jsdom doesn't handle the logic for any gradient function (linear-gradient, radial-gradient, conic-gradient, and its repeating variant).

spolarRASP commented 1 month ago

Hi, does someone work on this issue?