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

Child component className value regression from 7.0.7 to 7.0.8 #405

Open
dcaldastp opened this issue Mar 17, 2022 · 2 comments
Open

Child component className value regression from 7.0.7 to 7.0.8 #405

dcaldastp opened this issue Mar 17, 2022 · 2 comments

Comments

@dcaldastp
Copy link

dcaldastp commented Mar 17, 2022

Before (7.0.7)

Snapshot testing renders properly the child component styled component generated className

<div
  className="Align-sc-__sc-4yw49j-0 IconRoot-sc-__sc-1eorqw0-0 TQsYT ckURgz"

After (7.0.8)

Mismatch in snapshots, missing Align-sc-__sc-4yw49j-0 IconRoot-sc-__sc-1eorqw0-0

<div
-   className="Align-sc-__sc-4yw49j-0 IconRoot-sc-__sc-1eorqw0-0 TQsYT ckURgz"
+   className="TQsYT ckURgz"
    color="#BBB"

Our target component has the following tree structure

CustomIconComponent
|
|__ IconComponent  ===> this icon component has a styled component Align and IconRoot, respective className is missing

Looking at the changeset it seems that the only change in the latest patch has only changes related to babel & className

Details

Node version: 14.18.2
jest-styled-components: 7.0.8 (7.0.7 works fine)
styled-components: 5.2.1
jest: 27.5.1

@dcaldastp dcaldastp changed the title Child component className value regression from 7.0.2 to 7.0.3 Child component className value regression from 7.0.7 to 7.0.8 Mar 17, 2022
@GiancarlosIO
Copy link

I'm getting the same error with the latest version 7.0.8. Our tests that use the toHaveStyle matcher are broken :(

@dcaldastp
Copy link
Author

Hey @GiancarlosIO, if it helps, locking to "7.0.7", fixed our problem.

    "jest-styled-components": "7.0.7",

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