import React__default from 'react';
import { cleanup, render, screen } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { B as Button } from '../../index-Cqcn5RnV.js';
import '../../extends-C4cduGrv.js';
import '../../defineProperty-CEd-kZQW.js';
import '../../slicedToArray-BB-AwwkK.js';
import '../../objectWithoutProperties-TXwlfNxG.js';
import '../../typeof-CgC7Bq6K.js';
import '../../toConsumableArray-dKQYsfpV.js';
import '../../index-qSfOyGhk.js';
import 'react-dom';
import 'prop-types';
import 'classnames';
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-Cly76abB.js';
import '../../utils.esm-CKyxlHOy.js';
import '../../warning-s9zGJbnw.js';
import '../../portal.esm-CuKGPwhL.js';
import '@reach/visually-hidden';
import '../../portal/index.js';
import '../../use-rerender-once/index.js';
import '../../use-force-update/index.js';
import '../button-group.js';
import '../../inject-css-BqVV5N0s.js';

var DISABLED_CLASSES = "text-gray-600 bg-gray-100";
afterEach(cleanup);
describe("Button", function () {
  it("renders", function () {
    render( /*#__PURE__*/React__default.createElement(Button, null, "Deactivate Atrocity"));
    expect(screen.getByRole("button")).toBeInTheDocument();
  });
  it("has cursor-pointer when not disabled", function () {
    var jsx = /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Button, null, "Deactivate Atrocity"), /*#__PURE__*/React__default.createElement(Button, {
      is: "primary"
    }, "Activate Generosity"), /*#__PURE__*/React__default.createElement(Button, {
      disabled: false
    }, "Subscribe to The Thread\u2122"));
    render(jsx);
    var buttons = screen.getAllByRole("button");
    buttons.forEach(function (button) {
      expect(button).toHaveClass("cursor-pointer");
    });
  });
  it("has cursor-default when disabled", function () {
    var jsx = /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Button, {
      disabled: true
    }, "Deactivate Atrocity"), /*#__PURE__*/React__default.createElement(Button, {
      is: "primary",
      disabled: true
    }, "Activate Generosity"), /*#__PURE__*/React__default.createElement(Button, {
      disabled: true
    }, "Subscribe to The Thread\u2122"));
    render(jsx);
    var buttons = screen.getAllByRole("button");
    buttons.forEach(function (button) {
      expect(button).toHaveClass("cursor-default");
    });
  });
  it("applies disabled styles when `is` is set", function () {
    render( /*#__PURE__*/React__default.createElement(Button, {
      is: "primary",
      disabled: true
    }, "Click me"));
    var button = screen.getByRole("button");
    expect(button).toHaveClass(DISABLED_CLASSES);
  });
  it("applies disabled styles when `color` is set", function () {
    render( /*#__PURE__*/React__default.createElement(Button, {
      color: "red",
      disabled: true
    }, "Click me"));
    var button = screen.getByRole("button");
    expect(button).toHaveClass(DISABLED_CLASSES);
  });
  it("does not apply disabled styles when `is` or `color` is not set", function () {
    render( /*#__PURE__*/React__default.createElement(Button, {
      disabled: true
    }, "Click me"));
    var button = screen.getByRole("button");
    expect(button).not.toHaveClass(DISABLED_CLASSES);
  });
  it("does not set undefined classes", function () {
    var jsx = /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Button, null, "Deactivate Atrocity"), /*#__PURE__*/React__default.createElement(Button, {
      is: "primary"
    }, "Activate Generosity"), /*#__PURE__*/React__default.createElement(Button, {
      color: "red"
    }, "Subscribe to The Thread\u2122"), /*#__PURE__*/React__default.createElement(Button, {
      disabled: true
    }, "Unsubscribe from The Thread\u2122"));
    render(jsx);
    var buttons = screen.getAllByRole("button");
    buttons.forEach(function (button) {
      expect(button).not.toHaveClass("undefined");
    });
  });
});
