UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

34 lines (33 loc) 1.4 kB
import React from "react"; import { screen, fireEvent } from "@testing-library/react"; import "@testing-library/jest-dom"; import { renderWithChart } from "@jest/testUtilities"; import Information from "./information"; import { jsx as _jsx } from "react/jsx-runtime"; describe("Information component", function () { it("renders information button with correct attributes", function () { renderWithChart(/*#__PURE__*/_jsx(Information, {})); var button = screen.getByTestId("chartHeaderToolbox-information"); expect(button).toBeInTheDocument(); expect(button).not.toBeDisabled(); }); it("handles user interactions correctly", function () { renderWithChart(/*#__PURE__*/_jsx(Information, {})); var button = screen.getByTestId("chartHeaderToolbox-information"); fireEvent.click(button); // Button should be clickable and responsive expect(button).toBeInTheDocument(); }); it("respects disabled state and passes props correctly", function () { renderWithChart(/*#__PURE__*/_jsx(Information, { disabled: true, className: "custom-class", "data-test": "information" })); var button = screen.getByTestId("chartHeaderToolbox-information"); expect(button).toBeInTheDocument(); expect(button).toBeDisabled(); expect(button).toHaveClass("custom-class"); expect(button).toHaveAttribute("data-test", "information"); }); });