"use strict";

require("@testing-library/jest-dom");
var _react = require("@testing-library/react");
var _Picker = require("../Picker");
var _jsxRuntime = require("react/jsx-runtime");
describe('Picker Specs', function () {
  test('should render selected child wrapped with <PickerItem/>', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.Picker, {
      value: 1,
      children: [1, 2, 3, 4]
    }));
    var pickerValue = _react.screen.getByRole('spinbutton');
    var expected = '2';
    expect(pickerValue).toHaveTextContent(expected);
  });
  test('should set the max of <Picker> to be one less than the number of children', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.Picker, {
      value: 3,
      children: [1, 2, 3, 4]
    }));
    var pickerValue = _react.screen.getByLabelText('4 next item');
    var expectedAttribute = 'disabled';
    expect(pickerValue).toHaveAttribute(expectedAttribute);
  });
  test('should be disabled when empty', function () {
    (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.PickerBase, {
      children: []
    }));
    var pickerPreviousValue = _react.screen.getByLabelText('undefined previous item');
    var pickerNextValue = _react.screen.getByLabelText('undefined next item');
    var expectedAttribute = 'disabled';
    expect(pickerPreviousValue).toHaveAttribute(expectedAttribute);
    expect(pickerNextValue).toHaveAttribute(expectedAttribute);
  });
});