"use strict";

require("@testing-library/jest-dom");
var _react = require("@testing-library/react");
var _SwitchItem = require("../SwitchItem");
var _jsxRuntime = require("react/jsx-runtime");
describe('SwitchItem Specs', function () {
  test('should contain a Switch', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitchItem.SwitchItemBase, {
      children: "SwitchItem"
    }));
    var switchButton = _react.screen.getAllByRole('button')[1];
    var expected = 'switch';
    expect(switchButton).toHaveClass(expected);
  });
  test('should pass selected to Switch element', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitchItem.SwitchItemBase, {
      selected: true,
      children: "SwitchItem"
    }));
    var switchButton = _react.screen.getAllByRole('button')[1];
    var expected = 'selected';
    expect(switchButton).toHaveClass(expected);
  });
  test('should apply disabled when `disabled` prop is true', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitchItem.SwitchItemBase, {
      disabled: true,
      children: "SwitchItem"
    }));
    var switchButton = _react.screen.getAllByRole('button')[0];
    var expected = 'disabled';
    expect(switchButton).toHaveAttribute(expected);
  });
  test('should have `check` icon when specified', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitchItem.SwitchItemBase, {
      icon: "check",
      children: "SwitchItem"
    }));
    var icon = _react.screen.getByText('✓');
    expect(icon).toBeInTheDocument();
    expect(icon).toHaveClass('icon');
  });
  test('should show Switch with icon `squarelarge` for Carbon skin', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SwitchItem.SwitchItemBase, {
      skin: "carbon"
    }));

    // decimal converted charCode of Unicode 'squarelarge' character
    var expectedCode = 11035;
    var actualCode = _react.screen.getAllByRole('button')[1].children[0].textContent.codePointAt();
    expect(actualCode).toBe(expectedCode);
  });
});