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

Jest matcher matches all css properties #123

Closed
itsdouges opened this issue Apr 11, 2020 · 1 comment
Closed

Jest matcher matches all css properties #123

itsdouges opened this issue Apr 11, 2020 · 1 comment
Assignees
Labels
bug 🐛 Something isn't working good first issue 👌 Good for newcomers

Comments

@itsdouges
Copy link
Collaborator

  it('should create css from array', () => {
    const base = { fontSize: 12 };
    const next = ` font-size: 15px; `;
    const { getByText } = render(<div css={[base, next]}>hello world</div>);

    expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px');
  });

it should only match the last one - not both. this passes because of the bug.

@itsdouges itsdouges added bug 🐛 Something isn't working good first issue 👌 Good for newcomers labels Apr 11, 2020
@itsdouges itsdouges added this to the Table stakes v0.x.x milestone Apr 14, 2020
@danieldelcore danieldelcore self-assigned this Apr 16, 2020
@danieldelcore
Copy link
Collaborator

danieldelcore commented Apr 16, 2020

This test is technically correct because compiled doesn't dedupe style rules.

The below is valid css:

<div 
  css={`
     color: red;
     color: blue;
     :hover {
        color: green;
     }
  `} 
>foo</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working good first issue 👌 Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants