"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _ = _interopRequireDefault(require("."));

describe('Range', function () {
  _react["default"].createRef = jest.fn();

  _react["default"].createRef.mockReturnValue({
    current: {
      offsetWidth: 100
    }
  });

  var hndl = jest.fn();
  var opts = {
    showMarks: 5,
    showLabels: true,
    limit: {
      lower: 10
    }
  };
  var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
    defaultValue: 25,
    list: "example",
    max: 50,
    options: opts,
    step: 5,
    updateInfo: hndl
  }, /*#__PURE__*/_react["default"].createElement("datalist", {
    id: "example"
  }, /*#__PURE__*/_react["default"].createElement("option", {
    label: "\uD83D\uDC4D Drag...",
    value: 0
  }), /*#__PURE__*/_react["default"].createElement("option", {
    label: "\uD83D\uDC4C Halfway.",
    value: 25
  }), /*#__PURE__*/_react["default"].createElement("option", {
    label: "\uD83E\uDD18 Done!",
    value: 50
  }))));
  it('displays the <Range> element', function () {
    expect(node.getDOMNode().classList).toContain('Range');
  });
  it('should handle input', function () {
    var spy = {
      persist: jest.fn(),
      target: {
        value: 5
      }
    };
    node.find('input').simulate('input', spy);
    expect(spy.persist).toHaveBeenCalled();
  });
});