import React from "react";
import "@testing-library/jest-dom/extend-expect";
import { render, fireEvent } from "@testing-library/react";
import Popover from "../popover";
import PopoverBody from "../popover-body";

test("should open dropdown", () => {
  const { queryByTestId } = render(
    <Popover reference={<span data-testid="click-id">Click me</span>} placement="bottom">
      <PopoverBody className="test-class" data-testid="popover-body">
        Test text
      </PopoverBody>
    </Popover>
  );

  expect(queryByTestId("popover-body")).toBeTruthy();
  expect(queryByTestId("popover-body")).toHaveTextContent("Test text");
  expect(queryByTestId("popover-body")).toHaveClass("test-class");
});
