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

snapshots failing due to style prop differences #731

Closed
kentcdodds opened this issue Apr 13, 2018 · 5 comments
Closed

snapshots failing due to style prop differences #731

kentcdodds opened this issue Apr 13, 2018 · 5 comments
Labels

Comments

@kentcdodds
Copy link
Contributor

Hi 👋

So these snapshots pass locally and in CI, but not in codesandbox. https://codesandbox.io/s/249l243k5j

All the differences are in the style prop:

-       style="display: flex;"
+       style="display: flex; justify-content: space-around; align-items: center;"

I'm not sure why though... Seems like a bug.

@CompuIves
Copy link
Member

Heh that's indeed very weird... Also interesting to see that so many styles are different. Seems like justify-content: space-around; align-items: center; is constantly added for flex items for some reason... Maybe because it's ran for a second time in the same context?

I'll do some debugging on this!

@kentcdodds
Copy link
Contributor Author

In the meantime I removed the use of the style prop in those components to side-step the issue :)

@lbogdan
Copy link
Contributor

lbogdan commented May 1, 2018

@kentcdodds @CompuIves
Seems like there's an issue with the snapshots? For example, for test no. 12, the snapshot is

exports[`renders a toggle component 1`] = `
<div>
  <div>
    <div
      style="display: flex;"
    >
      <nav>
        <ul
          style="display: flex; list-style: none; padding-left: 0px;"
        >
          <li>
            <a
              href="index.html"
            >
              Home
            </a>
          </li>
[...]

but if I run it locally, go to /12/final and take a look at the html it's actually

<div>
  <div>
    <div>
      <div style="display: flex; justify-content: space-around; align-items: center;">
        <nav style="flex: 1 1 0%;">
          <ul style="display: flex; justify-content: space-around; list-style: none; padding-left: 0px;">
            <li>
              <a href="index.html">Home</a>
            </li>
[...]

Although, weirdly enough, running tests locally works. So it really looks like jest's snapshot renderer (or whoever's responsible for that) is stripping CSS attributes related to flexbox.

@github-actions
Copy link

github-actions bot commented Sep 4, 2020

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

@github-actions github-actions bot added the stale label Sep 4, 2020
@github-actions
Copy link

github-actions bot commented Oct 1, 2020

This issue has been automatically closed because there wasn't any activity after the previous notice or the stale label wasn't removed.

@github-actions github-actions bot closed this as completed Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants