"use strict";

var _jsxRuntime = require("react/jsx-runtime");

var _enzyme = require("enzyme");

var _Checkbox = require("../Checkbox");

var _CheckboxModule = _interopRequireDefault(require("../Checkbox.module.css"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

describe('Checkbox Specs', function () {
  test('should render correct icon when not selected', function () {
    var checkbox = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {}));
    var expected = 0;
    var actual = checkbox.find(".".concat(_CheckboxModule["default"].selected)).length;
    expect(actual).toBe(expected);
  });
  test('should render correct icon when selected', function () {
    var checkbox = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
      selected: true
    }));
    var expected = 1;
    var actual = checkbox.find(".".concat(_CheckboxModule["default"].selected)).length;
    expect(actual).toBe(expected);
  }); // Extra test cases

  test('should not include the indeterminate class when not indeterminate', function () {
    var checkbox = (0, _enzyme.shallow)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.CheckboxBase, {}));
    var expected = _CheckboxModule["default"].indeterminate;
    var actual = checkbox.prop('className');
    expect(actual).not.toContain(expected);
  });
  test('should add the indeterminate class when given the indeterminate prop', function () {
    var checkbox = (0, _enzyme.shallow)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.CheckboxBase, {
      indeterminate: true
    }));
    var expected = _CheckboxModule["default"].indeterminate;
    var actual = checkbox.prop('className');
    expect(actual).toContain(expected);
  });
  test('should prioritize indeterminate over selected', function () {
    var checkbox = (0, _enzyme.shallow)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.CheckboxBase, {
      indeterminate: true,
      selected: true,
      indeterminateIcon: "minus",
      children: "Sel"
    }));
    var expected = 'minus';
    var actual = checkbox.find('.icon').prop('children');
    expect(actual).toBe(expected);
  });
});