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

toHaveStyleRule should intelligently ignore spaces #89

Closed
jmjpro opened this issue Oct 30, 2017 · 2 comments
Closed

toHaveStyleRule should intelligently ignore spaces #89

jmjpro opened this issue Oct 30, 2017 · 2 comments

Comments

@jmjpro
Copy link

jmjpro commented Oct 30, 2017

I defined my styles using colors like rgba(101, 45, 144, 1). toHaveStyleRule() fails to match because styled-components seems to be removing spaces from the color value like this rgba(101,45,144,1). Either styled-components shouldn't remove the spaces, or toHaveStyleRule() should also ignore the spaces when comparing.

@MicheleBertoli
Copy link
Member

Hello @jmjpro, thanks for opening the issue.

I can't repro the problem in this repo.
For example, the following test works as expected in test/toHaveStyleRule.spec.js:

test('ignore spaces', () => {
  const Wrapper = styled.section`
    color: rgba(101, 45, 144, 1);
  `

  toHaveStyleRule(<Wrapper />, 'color', 'rgba(101, 45, 144, 1)')
})

However, this is not the first time we hear about a similar problem.
Can you please give us more info about your setup or provide a non-working example?

@MicheleBertoli
Copy link
Member

Ping @jmjpro : )

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

2 participants