mirror of
https://github.com/fleetdm/fleet
synced 2026-05-06 06:48:54 +00:00
* adding FE testing documentation * extend radio button tests * update test to work with new user-events lib version * more testing docs
27 lines
819 B
JavaScript
27 lines
819 B
JavaScript
import React from "react";
|
|
import { screen } from "@testing-library/react";
|
|
|
|
import { renderWithSetup } from "test/testingUtils";
|
|
import ClickableTableRow from "./index";
|
|
|
|
const clickSpy = jest.fn();
|
|
const dblClickSpy = jest.fn();
|
|
|
|
const props = {
|
|
onClick: clickSpy,
|
|
onDoubleClick: dblClickSpy,
|
|
};
|
|
|
|
describe("ClickableTableRow - component", () => {
|
|
it("calls onDblClick when row is double clicked", async () => {
|
|
const { user } = renderWithSetup(<ClickableTableRow {...props} />);
|
|
await user.dblClick(screen.getByRole("row"));
|
|
expect(dblClickSpy).toHaveBeenCalled();
|
|
});
|
|
|
|
it("calls onSelect when row is clicked", async () => {
|
|
const { user } = renderWithSetup(<ClickableTableRow {...props} />);
|
|
await user.click(screen.getByRole("row"));
|
|
expect(clickSpy).toHaveBeenCalled();
|
|
});
|
|
});
|