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

testing-library-react prints incorrect html for form when using screen.debug() #1619

Open
gkiely opened this issue Nov 21, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@gkiely
Copy link

gkiely commented Nov 21, 2024

Describe the bug
When using screen.debug with the following code

import { render, screen } from '@testing-library/react';
import { test } from 'vitest';
test('render', () => {
  render(<form>
    <div>test</div>
    <input type="text" />
    <button>submit</button>
  </form>);
  screen.debug();
})

happy-dom

bound HTMLFormElement {
  "0": <input
    type="text"
  />,
  "1": <button>
    submit
  </button>,
}

jsdom

<form>
  <div>
    test
  </div>
  <input
    type="text"
  />
  <button>
    submit
  </button>
</form>

To Reproduce

1. git clone https://github.com/gkiely/vite-project
3. npm i
4. npm test # output for jsdom
5. Update package.json: "test": "vitest --environment happy-dom"
6. npm test # output for happy-dom

Expected behavior
Should output all html in form

@gkiely gkiely added the bug Something isn't working label Nov 21, 2024
@gkiely
Copy link
Author

gkiely commented Nov 21, 2024

happy to open an issue with react-testing-library, just wanted to check here first 😄

@gkiely gkiely changed the title testing-library-react returns incorrect html for form when using screen.debug() testing-library-react prints incorrect html for form when using screen.debug() Nov 21, 2024
@psyvision
Copy link

Reference #1608

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

No branches or pull requests

2 participants