import React from "react";
import { fireEvent, render, cleanup, screen } from "@testing-library/react";
import EditableHeading from "../EditableHeading";
describe("EditableHeading", () => {
afterEach(() => {
cleanup();
});
it("should render an input in edit mode", () => {
render();
const component = screen.getByRole("button");
fireEvent.click(component);
const input = screen.queryByRole("input");
expect(input).toBeInTheDocument();
});
it("should not render an input when 'readOnly' is false when clicked", () => {
render();
const component = screen.getByRole("button");
fireEvent.click(component);
const input = screen.queryByRole("input");
expect(input).not.toBeInTheDocument();
});
});