We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
autoFocus
preact-testing-library
preact
node
npm
yarn
Relevant code or config
import React from "preact/compat"; import { render, fireEvent } from "@testing-library/preact"; // works: // import React from "react"; // import { render, fireEvent } from "@testing-library/react"; test("test", () => { const { getByTestId } = render( <div> <input data-testid="input" autoFocus /> </div> ); expect(document.activeElement).toBe(getByTestId("input")); });
What you did:
See code
What happened:
FAIL ./test.js ✕ test (25 ms) ● test expect(received).toBe(expected) // Object.is equality - Expected - 0 + Received + 6 + <body> + <div> + <div> <input autofocus="true" data-testid="input" /> + </div> + </div> + </body> 12 | ); 13 | > 14 | expect(document.activeElement).toBe(getByTestId("input")); | ^ 15 | }); 16 | at Object.<anonymous> (test.js:14:34)
Reproduction repository:
https://codesandbox.io/s/beautiful-cannon-gw4ee?file=/src/index.test.js
Problem description:
Apparently, the <input autoFocus> element isn't focused. The example works when changing out the imports to use React.
<input autoFocus>
Suggested solution:
Autofocus the element....
The text was updated successfully, but these errors were encountered:
Likely actually caused by jsdom/jsdom#3041...
Sorry, something went wrong.
No branches or pull requests
preact-testing-library
version: 2.0.0preact
version: 10.4.7node
version: 14npm
(oryarn
) version: .22.4Relevant code or config
What you did:
See code
What happened:
Reproduction repository:
https://codesandbox.io/s/beautiful-cannon-gw4ee?file=/src/index.test.js
Problem description:
Apparently, the
<input autoFocus>
element isn't focused. The example works when changing out the imports to use React.Suggested solution:
Autofocus the element....
The text was updated successfully, but these errors were encountered: