Open nsaritzky opened 1 year ago
Describe the bug The Popover element renders correctly and opens in the browser, but it fails to open when using vitest and testing-library.
To Reproduce See this repo for a reproduction. I made it by taking the following steps:
vitest.config.ts
App.tsx
import logo from "./logo.svg"; import styles from "./App.module.css";
const App: Component = () => { return (
); };
export default App;
4. Add a `App.test.tsx` file with the following: ```TSX import { render, screen } from "@solidjs/testing-library"; import userEvent from "@testing-library/user-event"; import { test, expect, beforeEach } from "vitest"; import "@testing-library/jest-dom"; import App from "./App"; test("Clicking 'open' sets aria-expanded to true", async () => { const user = userEvent.setup(); render(() => <App />); const open = screen.getByRole("button", { name: "open" }); await user.click(open); expect(open).toHaveAttribute("aria-expanded", "true"); }); test("Clicking 'open' opens a dialog", async () => { const user = userEvent.setup(); render(() => <App />); const open = screen.getByRole("button", { name: "open" }); await user.click(open); expect(screen.getByRole("dialog")); });
Expected behavior The popover opens in the browser and the tests pass. Instead, the tests fail on their expect lines.
expect
Desktop (please complete the following information):
I'm running into the same issue. Calling the debug() function prints out the HTML as expected with the popover open, but queries don't return the popover contents.
debug()
Describe the bug The Popover element renders correctly and opens in the browser, but it fails to open when using vitest and testing-library.
To Reproduce See this repo for a reproduction. I made it by taking the following steps:
vitest.config.ts
.App.tsx
:const App: Component = () => { return (
); };
export default App;
Expected behavior The popover opens in the browser and the tests pass. Instead, the tests fail on their
expect
lines.Desktop (please complete the following information):