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 '../../index-4e01772f.js';
import '../../typeof-6c6d8d7a.js';
import '../../toConsumableArray-f2f53597.js';
import '../../index-81a9bdac.js';
import '../../icon/assets/icon-map/index.js';
import '../../social-icon/index.js';
import '@fortawesome/react-fontawesome';
import '../../social-icon/icons.js';
import '../../social-icon/library.js';
import '@fortawesome/fontawesome-svg-core';
import '@fortawesome/free-solid-svg-icons';
import '@fortawesome/free-brands-svg-icons';
import '../../tooltip/index.js';
import '../../auto-id.esm-2b54f757.js';
import '../../utils.esm-514fad91.js';
import '../../warning-ed2bf294.js';
import '../../portal.esm-613949dc.js';
import '@reach/visually-hidden';
import '../../button/button-group.js';
import '../../use-previous/index.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);
  });
});
