"use strict";

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

var _enzyme = require("enzyme");

var _SliderButton = _interopRequireDefault(require("../SliderButton"));

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

var children = ['Light Speed', 'Ridiculous Speed', 'Ludicrous Speed'];
describe('SliderButton Specs', function () {
  test('should emit an onChange event when changing to value 1', function () {
    var handleChange = jest.fn();
    var evt = {
      value: 1
    };
    var sliderButton = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SliderButton["default"], {
      onChange: handleChange,
      children: children
    }));
    sliderButton.find('SliderButton').simulate('change', evt);
    var expected = 1;
    var actual = handleChange.mock.calls[0][0].value;
    expect(actual).toBe(expected);
  });
  test('should set "aria-valueText" to text when value is changed to the 2nd item', function () {
    var handleChange = jest.fn();
    var evt = {
      value: 1
    };
    var sliderButton = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SliderButton["default"], {
      onChange: handleChange,
      children: children
    }));
    sliderButton.find('SliderButton').simulate('change', evt);
    var valueText = sliderButton.find('SliderButton').prop('aria-valuetext');
    expect(valueText).toBe('Ridiculous Speed');
  });
  test('should set "aria-valueText" to text when value is changed to the 3rd item', function () {
    var handleChange = jest.fn();
    var evt = {
      value: 2
    };
    var sliderButton = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SliderButton["default"], {
      onChange: handleChange,
      children: children
    }));
    sliderButton.find('SliderButton').simulate('change', evt);
    var valueText = sliderButton.find('SliderButton').prop('aria-valuetext');
    expect(valueText).toBe('Ludicrous Speed');
  });
  test('should set "aria-valueText" to text when value is changed to the 1st item', function () {
    var handleChange = jest.fn();
    var evt = {
      value: 0
    };
    var sliderButton = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SliderButton["default"], {
      onChange: handleChange,
      children: children
    }));
    sliderButton.find('SliderButton').simulate('change', evt);
    var valueText = sliderButton.find('SliderButton').prop('aria-valuetext');
    expect(valueText).toBe('Light Speed');
  });
  test('should not emit onChange event when disabled', function () {
    var handleChange = jest.fn();
    var evt = {
      value: 1
    };
    var sliderButton = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SliderButton["default"], {
      disabled: true,
      onChange: handleChange,
      children: children
    }));
    sliderButton.find('SliderButton').simulate('change', evt);
    var expected = 0;
    var actual = handleChange.mock.calls.length;
    expect(actual).toBe(expected);
  });
});