"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _react = _interopRequireDefault(require("react"));
var _unit = require("../../utils/test-utils/unit");
var _RadarChart = _interopRequireDefault(require("../RadarChart"));
var _RadarChartPrivateUni = require("./RadarChart.private.uni.driver");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/RadarChart/test/RadarChart.spec.jsx",
  _this = void 0;
describe(_RadarChart["default"].displayName, function () {
  var render = (0, _unit.createRendererWithUniDriver)(_RadarChartPrivateUni.radarChartPrivateDriverFactory);
  afterEach(_unit.cleanup);
  describe('scale prop', function () {
    it('should render 2 scale lines by default', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
      var _render, driver;
      return _regenerator["default"].wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            _render = render(/*#__PURE__*/_react["default"].createElement(_RadarChart["default"], {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 17,
                columnNumber: 33
              }
            })), driver = _render.driver;
            _context.t0 = expect;
            _context.next = 4;
            return driver.getScaleLinesCount();
          case 4:
            _context.t1 = _context.sent;
            (0, _context.t0)(_context.t1).toEqual(2);
          case 6:
          case "end":
            return _context.stop();
        }
      }, _callee);
    })));
    it('should render [when] given scale property', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
      var scale, _render2, driver;
      return _regenerator["default"].wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            scale = [{
              value: 25,
              label: '25%'
            }, {
              value: 50,
              label: '50%'
            }, {
              value: 75,
              label: '75%'
            }, {
              value: 100,
              label: '100%'
            }];
            _render2 = render(/*#__PURE__*/_react["default"].createElement(_RadarChart["default"], {
              scale: scale,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 30,
                columnNumber: 33
              }
            })), driver = _render2.driver;
            _context2.t0 = expect;
            _context2.next = 5;
            return driver.getScaleLinesCount();
          case 5:
            _context2.t1 = _context2.sent;
            (0, _context2.t0)(_context2.t1).toEqual(4);
          case 7:
          case "end":
            return _context2.stop();
        }
      }, _callee2);
    })));
  });
  describe('data prop', function () {
    it('should render no data by default', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
      var _render3, driver;
      return _regenerator["default"].wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            _render3 = render(/*#__PURE__*/_react["default"].createElement(_RadarChart["default"], {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 38,
                columnNumber: 33
              }
            })), driver = _render3.driver;
            _context3.t0 = expect;
            _context3.next = 4;
            return driver.getDataItemsCount();
          case 4:
            _context3.t1 = _context3.sent;
            (0, _context3.t0)(_context3.t1).toEqual(0);
          case 6:
          case "end":
            return _context3.stop();
        }
      }, _callee3);
    })));
    it('should render data property [when] given', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
      var data, _render4, driver;
      return _regenerator["default"].wrap(function _callee4$(_context4) {
        while (1) switch (_context4.prev = _context4.next) {
          case 0:
            data = [{
              value: 10,
              label: 'Site Sessions'
            }, {
              value: 20,
              label: 'Visitors'
            }, {
              value: 30,
              label: 'Total Orders'
            }];
            _render4 = render(/*#__PURE__*/_react["default"].createElement(_RadarChart["default"], {
              data: data,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 59,
                columnNumber: 33
              }
            })), driver = _render4.driver;
            _context4.t0 = expect;
            _context4.next = 5;
            return driver.getDataItemsCount();
          case 5:
            _context4.t1 = _context4.sent;
            (0, _context4.t0)(_context4.t1).toEqual(3);
          case 7:
          case "end":
            return _context4.stop();
        }
      }, _callee4);
    })));
  });
  describe('disabled prop', function () {
    it('should render disabled [when] given', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5() {
      var data, _render5, driver;
      return _regenerator["default"].wrap(function _callee5$(_context5) {
        while (1) switch (_context5.prev = _context5.next) {
          case 0:
            data = [{
              value: 10,
              label: 'Site Sessions'
            }, {
              value: 20,
              label: 'Visitors'
            }, {
              value: 30,
              label: 'Total Orders'
            }];
            _render5 = render(/*#__PURE__*/_react["default"].createElement(_RadarChart["default"], {
              data: data,
              disabled: true,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 81,
                columnNumber: 33
              }
            })), driver = _render5.driver;
            _context5.t0 = expect;
            _context5.next = 5;
            return driver.isDisabled();
          case 5:
            _context5.t1 = _context5.sent;
            (0, _context5.t0)(_context5.t1).toEqual(true);
          case 7:
          case "end":
            return _context5.stop();
        }
      }, _callee5);
    })));
  });
  describe('hoverIndex prop', function () {
    it('hover index is changed when hoverIndex prop is changed', /*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7() {
      var data, _render6, driver, rerender;
      return _regenerator["default"].wrap(function _callee7$(_context7) {
        while (1) switch (_context7.prev = _context7.next) {
          case 0:
            data = [{
              value: 10,
              label: 'Site Sessions'
            }, {
              value: 20,
              label: 'Visitors'
            }, {
              value: 30,
              label: 'Total Orders'
            }];
            _render6 = render(/*#__PURE__*/_react["default"].createElement(_RadarChart["default"], {
              data: data,
              hoverIndex: 2,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 104,
                columnNumber: 9
              }
            })), driver = _render6.driver, rerender = _render6.rerender;
            _context7.next = 4;
            return (0, _unit.waitFor)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6() {
              return _regenerator["default"].wrap(function _callee6$(_context6) {
                while (1) switch (_context6.prev = _context6.next) {
                  case 0:
                    _context6.t0 = expect;
                    _context6.next = 3;
                    return driver.getHoverIndex();
                  case 3:
                    _context6.t1 = _context6.sent;
                    return _context6.abrupt("return", (0, _context6.t0)(_context6.t1).toEqual('2'));
                  case 5:
                  case "end":
                    return _context6.stop();
                }
              }, _callee6);
            })));
          case 4:
            rerender(/*#__PURE__*/_react["default"].createElement(_RadarChart["default"], {
              hoverIndex: 1,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 111,
                columnNumber: 16
              }
            }));
            _context7.t0 = expect;
            _context7.next = 8;
            return driver.getHoverIndex();
          case 8:
            _context7.t1 = _context7.sent;
            (0, _context7.t0)(_context7.t1).toEqual('1');
          case 10:
          case "end":
            return _context7.stop();
        }
      }, _callee7);
    })));
  });
});