nuxt / test-utils

🧪 Test utilities for Nuxt
http://nuxt.com/docs/getting-started/testing
MIT License
323 stars 84 forks source link

Rerender from @testing-library/vue not working #1014

Open LeoMo-27 opened 1 week ago

LeoMo-27 commented 1 week ago

Environment

Reproduction

https://stackblitz.com/edit/github-5sxamx-wxweax?file=components%2FMyComponent.nuxt.spec.ts

Describe the bug

When using rerender from @testing-library/vue the rendered component does not receive the props passed in the method. The issue is related with the suspense wrapper component created on the renderSuspended wrapper of the render method.

In the reproduction, you can see that the wrapper component created is the one that inherits the props passed to the rerender method. The expected HTML should look like this:

<body>
  <div
    data-v-app=""
    id="__nuxt"
  />
  <div>
    <div
      id="test-wrapper"
    >
      <p>
        Hello Vue 3
      </p>
    </div>
  </div>
</body>

But it looks like this:

<body>
  <div
    data-v-app=""
    id="__nuxt"
  />
  <div>
    <div
      id="test-wrapper"
      msg="Hello Vue 3"
    >
      <p>
        Hello in component
      </p>
    </div>
  </div>
</body>

Additional context

I tried solving the issue with no avail, I'm sorry I can not be of more help 😢