import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/BarChart/test/BarChart.spec.jsx",
  _this = this;
import _regeneratorRuntime from "@babel/runtime/regenerator";
import React from 'react';
import { cleanup, createRendererWithUniDriver } from '../../utils/test-utils/unit';
import BarChart from '../BarChart';
import { barChartPrivateDriverFactory } from './BarChart.private.uni.driver';
describe('BarChart', function () {
  var render = createRendererWithUniDriver(barChartPrivateDriverFactory);
  afterEach(function () {
    cleanup();
  });
  it('should render', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
    var items, _render, driver;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          items = [];
          _render = render(/*#__PURE__*/React.createElement(BarChart, {
            statistics: items,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 20,
              columnNumber: 31
            }
          })), driver = _render.driver;
          _context.t0 = expect;
          _context.next = 5;
          return driver.exists();
        case 5:
          _context.t1 = _context.sent;
          (0, _context.t0)(_context.t1).toBe(true);
        case 7:
        case "end":
          return _context.stop();
      }
    }, _callee);
  })));
  describe('one item', function () {
    var items;
    var driver;
    beforeEach(function () {
      items = [{
        value: 200,
        description: 'first description',
        descriptionInfo: 'first descriptionInfo'
      }];
      driver = render(/*#__PURE__*/React.createElement(BarChart, {
        items: items,
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 37,
          columnNumber: 23
        }
      })).driver;
    });
    it('should render ', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
      return _regeneratorRuntime.wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            _context2.t0 = expect;
            _context2.next = 3;
            return driver.getItemsCount();
          case 3:
            _context2.t1 = _context2.sent;
            (0, _context2.t0)(_context2.t1).toBe(1);
          case 5:
          case "end":
            return _context2.stop();
        }
      }, _callee2);
    })));
    it('should render value when there is no label', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
      return _regeneratorRuntime.wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            _context3.t0 = expect;
            _context3.next = 3;
            return driver.getValue(0);
          case 3:
            _context3.t1 = _context3.sent;
            (0, _context3.t0)(_context3.t1).toBe('200');
          case 5:
          case "end":
            return _context3.stop();
        }
      }, _callee3);
    })));
    it('should render value based on props', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
      return _regeneratorRuntime.wrap(function _callee4$(_context4) {
        while (1) switch (_context4.prev = _context4.next) {
          case 0:
            items = [{
              value: 100
            }];
            driver = render(/*#__PURE__*/React.createElement(BarChart, {
              items: items,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 50,
                columnNumber: 23
              }
            })).driver;
            _context4.t0 = expect;
            _context4.next = 5;
            return driver.getValue(0);
          case 5:
            _context4.t1 = _context4.sent;
            (0, _context4.t0)(_context4.t1).toBe('100');
          case 7:
          case "end":
            return _context4.stop();
        }
      }, _callee4);
    })));
    it('should render caption', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
      return _regeneratorRuntime.wrap(function _callee5$(_context5) {
        while (1) switch (_context5.prev = _context5.next) {
          case 0:
            items[0].label = 'myCaption';
            driver = render(/*#__PURE__*/React.createElement(BarChart, {
              items: items,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 57,
                columnNumber: 23
              }
            })).driver;
            _context5.t0 = expect;
            _context5.next = 5;
            return driver.getValue(0);
          case 5:
            _context5.t1 = _context5.sent;
            (0, _context5.t0)(_context5.t1).toBe('myCaption');
          case 7:
          case "end":
            return _context5.stop();
        }
      }, _callee5);
    })));
    it('should render short caption', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
      return _regeneratorRuntime.wrap(function _callee6$(_context6) {
        while (1) switch (_context6.prev = _context6.next) {
          case 0:
            items[0].label = 'My long caption';
            items[0].labelShort = 'caption';
            driver = render(/*#__PURE__*/React.createElement(BarChart, {
              items: items,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 65,
                columnNumber: 23
              }
            })).driver;
            _context6.t0 = expect;
            _context6.next = 6;
            return driver.getValue(0);
          case 6:
            _context6.t1 = _context6.sent;
            (0, _context6.t0)(_context6.t1).toBe('My long caption');
            _context6.t2 = expect;
            _context6.next = 11;
            return driver.getValueInShort(0);
          case 11:
            _context6.t3 = _context6.sent;
            (0, _context6.t2)(_context6.t3).toBe('caption');
          case 13:
          case "end":
            return _context6.stop();
        }
      }, _callee6);
    })));
    it('should render description', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
      return _regeneratorRuntime.wrap(function _callee7$(_context7) {
        while (1) switch (_context7.prev = _context7.next) {
          case 0:
            _context7.t0 = expect;
            _context7.next = 3;
            return driver.getDescription(0);
          case 3:
            _context7.t1 = _context7.sent;
            (0, _context7.t0)(_context7.t1).toBe('first description');
          case 5:
          case "end":
            return _context7.stop();
        }
      }, _callee7);
    })));
    it('should render tooltip with additional info on hover', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
      return _regeneratorRuntime.wrap(function _callee8$(_context8) {
        while (1) switch (_context8.prev = _context8.next) {
          case 0:
            _context8.t0 = expect;
            _context8.next = 3;
            return driver.getDescriptionInfo(0);
          case 3:
            _context8.t1 = _context8.sent;
            (0, _context8.t0)(_context8.t1).toBe('first descriptionInfo');
          case 5:
          case "end":
            return _context8.stop();
        }
      }, _callee8);
    })));
    it('should call onDescriptionInfo shown', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
      var onDescriptionInfoShown;
      return _regeneratorRuntime.wrap(function _callee9$(_context9) {
        while (1) switch (_context9.prev = _context9.next) {
          case 0:
            onDescriptionInfoShown = vi.fn();
            driver = render(/*#__PURE__*/React.createElement(BarChart, {
              items: items,
              onDescriptionInfoShown: onDescriptionInfoShown,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 83,
                columnNumber: 9
              }
            })).driver;
            _context9.next = 4;
            return driver.getDescriptionInfo(0);
          case 4:
            expect(onDescriptionInfoShown).toHaveBeenCalled();
          case 5:
          case "end":
            return _context9.stop();
        }
      }, _callee9);
    })));
  });
  describe('multiple items', function () {
    var items;
    var driver;
    beforeEach(function () {
      items = [{
        value: 100,
        description: 'first description',
        descriptionInfo: 'first descriptionInfo'
      }, {
        value: 200,
        label: '$200',
        description: 'first description',
        descriptionInfo: 'first descriptionInfo'
      }, {
        value: 300,
        description: 'first description',
        descriptionInfo: 'first descriptionInfo'
      }];
      driver = render(/*#__PURE__*/React.createElement(BarChart, {
        items: items,
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 117,
          columnNumber: 23
        }
      })).driver;
    });
    it('should render 3 items', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
      return _regeneratorRuntime.wrap(function _callee0$(_context0) {
        while (1) switch (_context0.prev = _context0.next) {
          case 0:
            _context0.t0 = expect;
            _context0.next = 3;
            return driver.getItemsCount();
          case 3:
            _context0.t1 = _context0.sent;
            (0, _context0.t0)(_context0.t1).toBe(3);
          case 5:
          case "end":
            return _context0.stop();
        }
      }, _callee0);
    })));
    it('should sort items', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1() {
      return _regeneratorRuntime.wrap(function _callee1$(_context1) {
        while (1) switch (_context1.prev = _context1.next) {
          case 0:
            _context1.t0 = expect;
            _context1.next = 3;
            return driver.getValue(0);
          case 3:
            _context1.t1 = _context1.sent;
            (0, _context1.t0)(_context1.t1).toBe('300');
            _context1.t2 = expect;
            _context1.next = 8;
            return driver.getValue(1);
          case 8:
            _context1.t3 = _context1.sent;
            (0, _context1.t2)(_context1.t3).toBe('$200');
            _context1.t4 = expect;
            _context1.next = 13;
            return driver.getValue(2);
          case 13:
            _context1.t5 = _context1.sent;
            (0, _context1.t4)(_context1.t5).toBe('100');
          case 15:
          case "end":
            return _context1.stop();
        }
      }, _callee1);
    })));
  });
});