Skip to content

Commit

Permalink
test: oppdater tester for Tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
piofinn committed Sep 24, 2024
1 parent 78acdef commit 252d6d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/jokul/src/components/tooltip/Tooltip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { axe } from "jest-axe";
import React from "react";
Expand All @@ -20,7 +20,7 @@ describe("Tooltip", () => {
expect(screen.queryByText(/Forklarende tekst/, { ignore: "[hidden]" })).not.toBeInTheDocument();

await user.hover(tooltipTrigger as HTMLElement);
expect(screen.queryByText(/Forklarende tekst/, { ignore: "[hidden]" })).toBeVisible();
await waitFor(() => expect(screen.queryByText(/Forklarende tekst/, { ignore: "[hidden]" })).toBeVisible());
});

it("should NOT show tooltip on hover when triggerOn is 'click'", async () => {
Expand All @@ -36,7 +36,7 @@ describe("Tooltip", () => {
expect(screen.queryByText(/Forklarende tekst/)).not.toBeInTheDocument();

await user.hover(tooltipTrigger as HTMLElement);
expect(screen.queryByText(/Forklarende tekst/)).not.toBeInTheDocument();
() => expect(screen.queryByText(/Forklarende tekst/)).not.toBeInTheDocument();
});

it("should show tooltip on click when triggerOn is 'click'", async () => {
Expand All @@ -52,7 +52,7 @@ describe("Tooltip", () => {
expect(screen.queryByText(/Forklarende tekst/)).not.toBeInTheDocument();

await user.click(tooltipTrigger as HTMLElement);
expect(screen.queryByText(/Forklarende tekst/)).toBeVisible();
await waitFor(() => expect(screen.queryByText(/Forklarende tekst/)).toBeVisible());
});

describe("Trigger", () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/tooltip-react/src/Tooltip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { axe } from "jest-axe";
import React from "react";
Expand All @@ -20,7 +20,7 @@ describe("Tooltip", () => {
expect(screen.queryByText(/Forklarende tekst/, { ignore: "[hidden]" })).not.toBeInTheDocument();

await user.hover(tooltipTrigger as HTMLElement);
expect(screen.queryByText(/Forklarende tekst/, { ignore: "[hidden]" })).toBeVisible();
await waitFor(() => expect(screen.queryByText(/Forklarende tekst/, { ignore: "[hidden]" })).toBeVisible());
});

it("should NOT show tooltip on hover when triggerOn is 'click'", async () => {
Expand Down Expand Up @@ -52,7 +52,7 @@ describe("Tooltip", () => {
expect(screen.queryByText(/Forklarende tekst/)).not.toBeInTheDocument();

await user.click(tooltipTrigger as HTMLElement);
expect(screen.queryByText(/Forklarende tekst/)).toBeVisible();
await waitFor(() => expect(screen.queryByText(/Forklarende tekst/)).toBeVisible());
});

describe("Trigger", () => {
Expand Down

0 comments on commit 252d6d0

Please sign in to comment.