import React__default from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import Popover, { PopoverButton, PopoverContent } from '../index.js';
import '../../defineProperty-18999f8e.js';
import '../../extends-e61fd370.js';
import '../../objectWithoutProperties-72d23964.js';
import 'prop-types';
import '../../portal/index.js';
import '../../slicedToArray-5b664d46.js';
import 'react-dom';
import '../../use-rerender-once/index.js';
import '../../use-force-update/index.js';
import 'classnames';
import '../../button/index.js';
import '@reach/visually-hidden';
import '../../ck-icon/index.js';
import '../../ck-icon/assets/icon-map/index.js';
import '../../icon/index.js';
import '@fortawesome/react-fontawesome';
import '../../icon/icons.js';
import '../../icon/library.js';
import '@fortawesome/fontawesome-svg-core';
import '@fortawesome/pro-solid-svg-icons';
import '@fortawesome/pro-light-svg-icons';
import '@fortawesome/free-brands-svg-icons';
import '../../button/button-group.js';
import '../../use-previous/index.js';
import '../../typeof-6c6d8d7a.js';

describe("Popover", function () {
  it("runs onClose function", function () {
    var handleClose = jest.fn();
    render( /*#__PURE__*/React__default.createElement(Popover, {
      label: "Popover test"
    }, /*#__PURE__*/React__default.createElement(PopoverButton, null, "Toggle"), /*#__PURE__*/React__default.createElement(PopoverContent, {
      onClose: handleClose,
      tabIndex: 0
    }, "Content")));
    var button = screen.getByText("Toggle");
    expect(handleClose).not.toHaveBeenCalled();
    fireEvent.click(button);
    expect(handleClose).not.toHaveBeenCalled();
    fireEvent.click(button);
    expect(handleClose).toHaveBeenCalledTimes(1);
  });
});
