Closed chad3814 closed 5 years ago
Closing for inactivity.
It'd be nice to re-open this. I just ran into this and it was driving me crazy. I had some code that effectively does this:
if (props.imageurl) {
styles.backgroundImage = `url(${props.imageurl}), url(default.png)`;
} else {
styles.backgroundImage = `url(default.png)`;
}
Then I had 2 tests using react-testing-library
. 1 was working, 1 wasn't.
expect(div.style.backgroundImage).toEqual('url(default.png)')
worked, and my test with:
expect(div.style.backgroundImage).toEqual('url(test.png), url(default.png)')
failed b/c the string was empty.
I did a bunch of debugging, and knew I was setting the backgroundImage appropriately, but jsdom wasn't recognized the attribute.
^^ actually- I don't care if the Support more css3 syntax
issue is re-opened. But I would like to see jsdom support multiple background images.
it might be as easy as calling v.split(',')
somewhere, and looping through the array calling the same parseUrl()
code:
https://github.com/jsdom/cssstyle/blob/master/lib/properties/backgroundImage.js#L6
i've never looked at this codebase before, but might try to work on something if i get some time. thanks for your work on this!!!
I logged a new issue for my request: https://github.com/jsdom/cssstyle/issues/103
I'll try to submit a PR this week.
to do things right would require a big overhaul to the parsers I think. might make sense to use jison or some other context-free grammar parser.