import _extends from "@babel/runtime/helpers/extends";
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/FloatingHelper/FloatingHelperContent/test/FloatingHelperContent.spec.jsx";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import React from 'react';
import { floatingHelperContentUniDriverFactory } from '../FloatingHelperContent.uni.driver';
import FloatingHelperContent from '../FloatingHelperContent';
import { createRendererWithUniDriver, cleanup } from '../../../utils/test-utils/unit';
describe('FloatingHelperContent', function () {
  var requiredProps = {
    body: 'this is the body'
  };
  describe('[async]', function () {
    runTests(createRendererWithUniDriver(floatingHelperContentUniDriverFactory));
  });
  function runTests(render) {
    var _this = this;
    afterEach(function () {
      return cleanup();
    });
    it('should render', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
      var _render, driver;
      return _regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            _render = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, {
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 22,
                columnNumber: 33
              }
            }))), driver = _render.driver;
            _context.t0 = expect;
            _context.next = 4;
            return driver.exists();
          case 4:
            _context.t1 = _context.sent;
            (0, _context.t0)(_context.t1).toBe(true);
          case 6:
          case "end":
            return _context.stop();
        }
      }, _callee);
    })));
    describe('title prop', function () {
      it('should not have title by default', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
        var _render2, driver;
        return _regeneratorRuntime.wrap(function _callee2$(_context2) {
          while (1) switch (_context2.prev = _context2.next) {
            case 0:
              _render2 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 28,
                  columnNumber: 35
                }
              }))), driver = _render2.driver;
              _context2.t0 = expect;
              _context2.next = 4;
              return driver.hasTitle();
            case 4:
              _context2.t1 = _context2.sent;
              (0, _context2.t0)(_context2.t1).toBe(false);
            case 6:
            case "end":
              return _context2.stop();
          }
        }, _callee2);
      })));
      it('should have title with proper content', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
        var props, _render3, driver;
        return _regeneratorRuntime.wrap(function _callee3$(_context3) {
          while (1) switch (_context3.prev = _context3.next) {
            case 0:
              props = {
                title: 'title'
              };
              _render3 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 35,
                  columnNumber: 11
                }
              }))), driver = _render3.driver;
              _context3.t0 = expect;
              _context3.next = 5;
              return driver.hasTitle();
            case 5:
              _context3.t1 = _context3.sent;
              (0, _context3.t0)(_context3.t1).toBe(true);
              _context3.t2 = expect;
              _context3.next = 10;
              return driver.getTitleContent();
            case 10:
              _context3.t3 = _context3.sent;
              (0, _context3.t2)(_context3.t3).toBe(props.title);
            case 12:
            case "end":
              return _context3.stop();
          }
        }, _callee3);
      })));
    });
    describe('body prop', function () {
      it('should have body with simple text content', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
        var props, _render4, driver;
        return _regeneratorRuntime.wrap(function _callee4$(_context4) {
          while (1) switch (_context4.prev = _context4.next) {
            case 0:
              props = {
                body: 'body'
              };
              _render4 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 46,
                  columnNumber: 11
                }
              }))), driver = _render4.driver;
              _context4.t0 = expect;
              _context4.next = 5;
              return driver.hasBody();
            case 5:
              _context4.t1 = _context4.sent;
              (0, _context4.t0)(_context4.t1).toBe(true);
              _context4.t2 = expect;
              _context4.next = 10;
              return driver.getBodyContent();
            case 10:
              _context4.t3 = _context4.sent;
              (0, _context4.t2)(_context4.t3).toBe(props.body);
            case 12:
            case "end":
              return _context4.stop();
          }
        }, _callee4);
      })));
      it('should accept node as body', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
        var content, props, _render5, driver;
        return _regeneratorRuntime.wrap(function _callee5$(_context5) {
          while (1) switch (_context5.prev = _context5.next) {
            case 0:
              content = 'body';
              props = {
                body: /*#__PURE__*/React.createElement("div", {
                  __self: _this,
                  __source: {
                    fileName: _jsxFileName,
                    lineNumber: 54,
                    columnNumber: 31
                  }
                }, content)
              };
              _render5 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 56,
                  columnNumber: 11
                }
              }))), driver = _render5.driver;
              _context5.t0 = expect;
              _context5.next = 6;
              return driver.hasBody();
            case 6:
              _context5.t1 = _context5.sent;
              (0, _context5.t0)(_context5.t1).toBe(true);
              _context5.t2 = expect;
              _context5.next = 11;
              return driver.getBodyContent();
            case 11:
              _context5.t3 = _context5.sent;
              (0, _context5.t2)(_context5.t3).toBe(content);
            case 13:
            case "end":
              return _context5.stop();
          }
        }, _callee5);
      })));
    });
    describe('action button', function () {
      it('should not have action button by default', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
        var _render6, driver;
        return _regeneratorRuntime.wrap(function _callee6$(_context6) {
          while (1) switch (_context6.prev = _context6.next) {
            case 0:
              _render6 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 65,
                  columnNumber: 35
                }
              }))), driver = _render6.driver;
              _context6.t0 = expect;
              _context6.next = 4;
              return driver.hasActionButton();
            case 4:
              _context6.t1 = _context6.sent;
              (0, _context6.t0)(_context6.t1).toBe(false);
            case 6:
            case "end":
              return _context6.stop();
          }
        }, _callee6);
      })));
      it('should not have action button if only actionText is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
        var props, _render7, driver;
        return _regeneratorRuntime.wrap(function _callee7$(_context7) {
          while (1) switch (_context7.prev = _context7.next) {
            case 0:
              props = {
                actionText: 'Click Me!'
              };
              _render7 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 72,
                  columnNumber: 11
                }
              }))), driver = _render7.driver;
              _context7.t0 = expect;
              _context7.next = 5;
              return driver.hasActionButton();
            case 5:
              _context7.t1 = _context7.sent;
              (0, _context7.t0)(_context7.t1).toBe(false);
            case 7:
            case "end":
              return _context7.stop();
          }
        }, _callee7);
      })));
      it('should not have action button if only onActionClick is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
        var props, _render8, driver;
        return _regeneratorRuntime.wrap(function _callee8$(_context8) {
          while (1) switch (_context8.prev = _context8.next) {
            case 0:
              props = {
                onActionClick: function onActionClick() {
                  return null;
                }
              };
              _render8 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 80,
                  columnNumber: 11
                }
              }))), driver = _render8.driver;
              _context8.t0 = expect;
              _context8.next = 5;
              return driver.hasActionButton();
            case 5:
              _context8.t1 = _context8.sent;
              (0, _context8.t0)(_context8.t1).toBe(false);
            case 7:
            case "end":
              return _context8.stop();
          }
        }, _callee8);
      })));
      it('should not have action button if actionText is an empty string', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
        var props, _render9, driver;
        return _regeneratorRuntime.wrap(function _callee9$(_context9) {
          while (1) switch (_context9.prev = _context9.next) {
            case 0:
              props = {
                onActionClick: function onActionClick() {
                  return null;
                },
                actionText: ''
              };
              _render9 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 88,
                  columnNumber: 11
                }
              }))), driver = _render9.driver;
              _context9.t0 = expect;
              _context9.next = 5;
              return driver.hasActionButton();
            case 5:
              _context9.t1 = _context9.sent;
              (0, _context9.t0)(_context9.t1).toBe(false);
            case 7:
            case "end":
              return _context9.stop();
          }
        }, _callee9);
      })));
      it('should have action button with correct text', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
        var props, _render0, driver;
        return _regeneratorRuntime.wrap(function _callee0$(_context0) {
          while (1) switch (_context0.prev = _context0.next) {
            case 0:
              props = {
                onActionClick: function onActionClick() {
                  return null;
                },
                actionText: 'Click Me!'
              };
              _render0 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 96,
                  columnNumber: 11
                }
              }))), driver = _render0.driver;
              _context0.t0 = expect;
              _context0.next = 5;
              return driver.hasActionButton();
            case 5:
              _context0.t1 = _context0.sent;
              (0, _context0.t0)(_context0.t1).toBe(true);
              _context0.t2 = expect;
              _context0.next = 10;
              return driver.getActionButtonText();
            case 10:
              _context0.t3 = _context0.sent;
              (0, _context0.t2)(_context0.t3).toBe(props.actionText);
            case 12:
            case "end":
              return _context0.stop();
          }
        }, _callee0);
      })));
      it('should call onClick when action button clicked', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1() {
        var props, _render1, driver;
        return _regeneratorRuntime.wrap(function _callee1$(_context1) {
          while (1) switch (_context1.prev = _context1.next) {
            case 0:
              props = {
                onActionClick: vi.fn(),
                actionText: 'Click Me!'
              };
              _render1 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 105,
                  columnNumber: 11
                }
              }))), driver = _render1.driver;
              _context1.next = 4;
              return driver.clickActionButton();
            case 4:
              expect(props.onActionClick).toHaveBeenCalledTimes(1);
            case 5:
            case "end":
              return _context1.stop();
          }
        }, _callee1);
      })));
    });
    describe('footer prop', function () {
      it('should not be visible by default', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
        var _render10, driver;
        return _regeneratorRuntime.wrap(function _callee10$(_context10) {
          while (1) switch (_context10.prev = _context10.next) {
            case 0:
              _render10 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 114,
                  columnNumber: 35
                }
              }))), driver = _render10.driver;
              _context10.t0 = expect;
              _context10.next = 4;
              return driver.hasFooter();
            case 4:
              _context10.t1 = _context10.sent;
              (0, _context10.t0)(_context10.t1).toBe(false);
            case 6:
            case "end":
              return _context10.stop();
          }
        }, _callee10);
      })));
      it('should display footer content', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
        var props, _render11, driver;
        return _regeneratorRuntime.wrap(function _callee11$(_context11) {
          while (1) switch (_context11.prev = _context11.next) {
            case 0:
              props = {
                footer: /*#__PURE__*/React.createElement("div", {
                  __self: _this,
                  __source: {
                    fileName: _jsxFileName,
                    lineNumber: 119,
                    columnNumber: 33
                  }
                }, "footer")
              };
              _render11 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 121,
                  columnNumber: 11
                }
              }))), driver = _render11.driver;
              _context11.t0 = expect;
              _context11.next = 5;
              return driver.hasFooter();
            case 5:
              _context11.t1 = _context11.sent;
              (0, _context11.t0)(_context11.t1).toBe(true);
            case 7:
            case "end":
              return _context11.stop();
          }
        }, _callee11);
      })));
    });
    describe('image prop', function () {
      it('should not be visible by default', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
        var _render12, driver;
        return _regeneratorRuntime.wrap(function _callee12$(_context12) {
          while (1) switch (_context12.prev = _context12.next) {
            case 0:
              _render12 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 129,
                  columnNumber: 35
                }
              }))), driver = _render12.driver;
              _context12.t0 = expect;
              _context12.next = 4;
              return driver.hasImage();
            case 4:
              _context12.t1 = _context12.sent;
              (0, _context12.t0)(_context12.t1).toBe(false);
            case 6:
            case "end":
              return _context12.stop();
          }
        }, _callee12);
      })));
      it('should render the image', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
        var props, _render13, driver;
        return _regeneratorRuntime.wrap(function _callee13$(_context13) {
          while (1) switch (_context13.prev = _context13.next) {
            case 0:
              props = {
                image: /*#__PURE__*/React.createElement("div", {
                  __self: _this,
                  __source: {
                    fileName: _jsxFileName,
                    lineNumber: 134,
                    columnNumber: 32
                  }
                }, "\uD83E\uDD14")
              };
              _render13 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 136,
                  columnNumber: 11
                }
              }))), driver = _render13.driver;
              _context13.t0 = expect;
              _context13.next = 5;
              return driver.hasImage();
            case 5:
              _context13.t1 = _context13.sent;
              (0, _context13.t0)(_context13.t1).toBe(true);
            case 7:
            case "end":
              return _context13.stop();
          }
        }, _callee13);
      })));
      it('should render the image with direction vertical', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
        var props, _render14, driver;
        return _regeneratorRuntime.wrap(function _callee14$(_context14) {
          while (1) switch (_context14.prev = _context14.next) {
            case 0:
              props = {
                image: /*#__PURE__*/React.createElement("div", {
                  __self: _this,
                  __source: {
                    fileName: _jsxFileName,
                    lineNumber: 141,
                    columnNumber: 32
                  }
                }, "\uD83E\uDD14"),
                direction: 'vertical'
              };
              _render14 = render(/*#__PURE__*/React.createElement(FloatingHelperContent, _extends({}, requiredProps, props, {
                __self: _this,
                __source: {
                  fileName: _jsxFileName,
                  lineNumber: 143,
                  columnNumber: 11
                }
              }))), driver = _render14.driver;
              _context14.t0 = expect;
              _context14.next = 5;
              return driver.hasImage();
            case 5:
              _context14.t1 = _context14.sent;
              (0, _context14.t0)(_context14.t1).toBe(true);
              _context14.t2 = expect;
              _context14.next = 10;
              return driver.getDirection();
            case 10:
              _context14.t3 = _context14.sent;
              (0, _context14.t2)(_context14.t3).toBe('vertical');
            case 12:
            case "end":
              return _context14.stop();
          }
        }, _callee14);
      })));
    });
  }
});