UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

37 lines (35 loc) 1.73 kB
"use strict"; var _react = _interopRequireDefault(require("react")); var _react2 = require("@testing-library/react"); require("@testing-library/jest-dom"); var _testUtilities = require("@jest/testUtilities"); var _information = _interopRequireDefault(require("./information")); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } describe("Information component", function () { it("renders information button with correct attributes", function () { (0, _testUtilities.renderWithChart)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_information["default"], {})); var button = _react2.screen.getByTestId("chartHeaderToolbox-information"); expect(button).toBeInTheDocument(); expect(button).not.toBeDisabled(); }); it("handles user interactions correctly", function () { (0, _testUtilities.renderWithChart)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_information["default"], {})); var button = _react2.screen.getByTestId("chartHeaderToolbox-information"); _react2.fireEvent.click(button); // Button should be clickable and responsive expect(button).toBeInTheDocument(); }); it("respects disabled state and passes props correctly", function () { (0, _testUtilities.renderWithChart)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_information["default"], { disabled: true, className: "custom-class", "data-test": "information" })); var button = _react2.screen.getByTestId("chartHeaderToolbox-information"); expect(button).toBeInTheDocument(); expect(button).toBeDisabled(); expect(button).toHaveClass("custom-class"); expect(button).toHaveAttribute("data-test", "information"); }); });