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

Support more css3 syntax #32

Closed
chad3814 opened this issue Jul 14, 2015 · 5 comments
Closed

Support more css3 syntax #32

chad3814 opened this issue Jul 14, 2015 · 5 comments

Comments

@chad3814
Copy link
Contributor

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.

@jsakas
Copy link
Member

jsakas commented Sep 1, 2019

Closing for inactivity.

@jsakas jsakas closed this as completed Sep 1, 2019
@skratchdot
Copy link

skratchdot commented Sep 24, 2019

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.

@skratchdot
Copy link

^^ 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.

@skratchdot
Copy link

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!!!

@skratchdot
Copy link

I logged a new issue for my request:
#103

I'll try to submit a PR this week.

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

No branches or pull requests

3 participants