import React__default from 'react';
import { cleanup, render, screen } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import Button from '../index.js';
import '../../defineProperty-CEd-kZQW.js';
import '../../extends-C4cduGrv.js';
import '../../objectWithoutProperties-TXwlfNxG.js';
import 'prop-types';
import '@reach/visually-hidden';
import '../../ck-icon/index.js';
import 'classnames';
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 '../../slicedToArray-BB-AwwkK.js';
import '../../floating-ui.react-cWPyyUrN.js';
import '../../typeof-CgC7Bq6K.js';
import '../../toConsumableArray-dKQYsfpV.js';
import '../../index-qSfOyGhk.js';
import 'react-dom';
import '../button-group.js';

var DISABLED_CLASSES = "text-gray-600 bg-gray-200";
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");
    });
  });
});
