/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import { render } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import assert from "assert"; import React from "react"; import { Tooltip } from "./tooltip"; describe("", () => { it("does not render to DOM if not visibile", () => { const result = render(( <> I am a tooltip
Target Text
)); expect(result.baseElement).toMatchSnapshot(); }); it("renders to DOM when hovering over target", () => { const result = render(( <> I am a tooltip
Target Text
)); const target = result.baseElement.querySelector("#my-target"); assert(target); userEvent.hover(target); expect(result.baseElement).toMatchSnapshot(); }); it("renders to DOM when forced to by visibile prop", () => { const result = render(( <> I am a tooltip
Target Text
)); expect(result.baseElement).toMatchSnapshot(); }); });