Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New] Added test cases for tooltip #237

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions app/javascript/components/tooltip/component.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { mountedComponent, screen } from "../../test-utils";

import Tooltip from "./component";

describe("components/tooltip", () => {
it("renders tooltip", () => {
const TooltipComponent = () => (

Check failure on line 7 in app/javascript/components/tooltip/component.spec.js

View workflow job for this annotation

GitHub Actions / Client Linter

Component definition is missing display name
<Tooltip title="wrapper content" data-testid="wrapper-content">
<div>wrapped children</div>
</Tooltip>
);

mountedComponent(<TooltipComponent />);
expect(screen.getByText(/wrapped children/i)).toBeInTheDocument();
});

it("does not render tooltip without title", () => {
const TooltipComponent = () => (

Check failure on line 18 in app/javascript/components/tooltip/component.spec.js

View workflow job for this annotation

GitHub Actions / Client Linter

Component definition is missing display name

Check warning on line 18 in app/javascript/components/tooltip/component.spec.js

View workflow job for this annotation

GitHub Actions / Client Linter

Declare only one React component per file
<Tooltip title="">
<div>wrapped children</div>
</Tooltip>
);

mountedComponent(<TooltipComponent />);
expect(screen.getByText(/wrapped children/i)).toBeInTheDocument();
expect(screen.queryAllByRole("tooltip")).toHaveLength(0);
});
});
33 changes: 0 additions & 33 deletions app/javascript/components/tooltip/component.unit.test.js

This file was deleted.

Loading