import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/TableToolbar/test/TableToolbar.spec.jsx",
  _this = this;
import _regeneratorRuntime from "@babel/runtime/regenerator";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import React from 'react';
import { createRendererWithUniDriver } from '../../utils/test-utils/react';
import TableToolbar from '../TableToolbar';
import { baseUniDriverFactory } from '../../utils/test-utils/unidriver';
describe('TableToolbar', function () {
  var tableToolbarUniDriverFactory = function tableToolbarUniDriverFactory(base) {
    return _objectSpread(_objectSpread({}, baseUniDriverFactory(base)), {}, {
      getByDataHook: function () {
        var _getByDataHook = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dataHook) {
          var element;
          return _regeneratorRuntime.wrap(function _callee$(_context) {
            while (1) switch (_context.prev = _context.next) {
              case 0:
                element = base.$("[data-hook=".concat(dataHook, "]"));
                _context.next = 3;
                return element.exists();
              case 3:
                if (_context.sent) {
                  _context.next = 5;
                  break;
                }
                return _context.abrupt("return", false);
              case 5:
                return _context.abrupt("return", element);
              case 6:
              case "end":
                return _context.stop();
            }
          }, _callee);
        }));
        function getByDataHook(_x) {
          return _getByDataHook.apply(this, arguments);
        }
        return getByDataHook;
      }()
    });
  };
  var render = createRendererWithUniDriver(tableToolbarUniDriverFactory);
  it('Should allow adding datahook to TableToolbar.Title', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
    var dataHook, _render, driver;
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) switch (_context2.prev = _context2.next) {
        case 0:
          dataHook = 'toolbar-title';
          _render = render(/*#__PURE__*/React.createElement(TableToolbar, {
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 25,
              columnNumber: 7
            }
          }, /*#__PURE__*/React.createElement(TableToolbar.Item, {
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 26,
              columnNumber: 9
            }
          }, /*#__PURE__*/React.createElement(TableToolbar.Title, {
            dataHook: dataHook,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 27,
              columnNumber: 11
            }
          })))), driver = _render.driver;
          _context2.t0 = expect;
          _context2.next = 5;
          return driver.getByDataHook(dataHook);
        case 5:
          _context2.t1 = _context2.sent;
          (0, _context2.t0)(_context2.t1).toBeTruthy();
        case 7:
        case "end":
          return _context2.stop();
      }
    }, _callee2);
  })));
  it('Should allow adding datahook to TableToolbar.SelectedCount', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
    var dataHook, _render2, driver;
    return _regeneratorRuntime.wrap(function _callee3$(_context3) {
      while (1) switch (_context3.prev = _context3.next) {
        case 0:
          dataHook = 'toolbar-selected-count';
          _render2 = render(/*#__PURE__*/React.createElement(TableToolbar, {
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 37,
              columnNumber: 7
            }
          }, /*#__PURE__*/React.createElement(TableToolbar.Item, {
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 38,
              columnNumber: 9
            }
          }, /*#__PURE__*/React.createElement(TableToolbar.SelectedCount, {
            dataHook: dataHook,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 39,
              columnNumber: 11
            }
          })))), driver = _render2.driver;
          _context3.t0 = expect;
          _context3.next = 5;
          return driver.getByDataHook(dataHook);
        case 5:
          _context3.t1 = _context3.sent;
          (0, _context3.t0)(_context3.t1).toBeTruthy();
        case 7:
        case "end":
          return _context3.stop();
      }
    }, _callee3);
  })));
});