import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/Avatar/test/Avatar.spec.jsx",
  _this = this;
import _regeneratorRuntime from "@babel/runtime/regenerator";
import React from 'react';
import Avatar from '..';
import { createRendererWithUniDriver } from '../../utils/test-utils/unit';
import { avatarUniDriverFactory } from '../Avatar.uni.driver';
import { PhotoCamera } from '@wix/wix-ui-icons-common';
describe('Avatar', function () {
  var createDriver = createRendererWithUniDriver(avatarUniDriverFactory);
  it('should have correct displayName', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          expect(Avatar.displayName).toEqual('Avatar');
        case 1:
        case "end":
          return _context.stop();
      }
    }, _callee);
  })));
  it('should invoke onIndicationClick prop', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
    var onClick, _createDriver, driver;
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) switch (_context2.prev = _context2.next) {
        case 0:
          onClick = vi.fn();
          _createDriver = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            onIndicationClick: onClick,
            indication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 19,
                columnNumber: 21
              }
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 17,
              columnNumber: 7
            }
          })), driver = _createDriver.driver;
          _context2.next = 4;
          return driver.clickIndication();
        case 4:
          expect(onClick).toHaveBeenCalledTimes(1);
        case 5:
        case "end":
          return _context2.stop();
      }
    }, _callee2);
  })));
  it('should invoke onIndicationClick prop with custom indication', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
    var onClick, _createDriver2, driver;
    return _regeneratorRuntime.wrap(function _callee3$(_context3) {
      while (1) switch (_context3.prev = _context3.next) {
        case 0:
          onClick = vi.fn();
          _createDriver2 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            onIndicationClick: onClick,
            customIndication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 32,
                columnNumber: 27
              }
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 30,
              columnNumber: 7
            }
          })), driver = _createDriver2.driver;
          _context3.next = 4;
          return driver.clickCustomIndication();
        case 4:
          expect(onClick).toHaveBeenCalledTimes(1);
        case 5:
        case "end":
          return _context3.stop();
      }
    }, _callee3);
  })));
  it('should invoke onClick prop', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
    var onClick, _createDriver3, driver;
    return _regeneratorRuntime.wrap(function _callee4$(_context4) {
      while (1) switch (_context4.prev = _context4.next) {
        case 0:
          onClick = vi.fn();
          _createDriver3 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            onClick: onClick,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 42,
              columnNumber: 37
            }
          })), driver = _createDriver3.driver;
          _context4.next = 4;
          return driver.click();
        case 4:
          expect(onClick).toHaveBeenCalledTimes(1);
        case 5:
        case "end":
          return _context4.stop();
      }
    }, _callee4);
  })));
  it('should render indication', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
    var _createDriver4, driver;
    return _regeneratorRuntime.wrap(function _callee5$(_context5) {
      while (1) switch (_context5.prev = _context5.next) {
        case 0:
          _createDriver4 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            indication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 50,
                columnNumber: 27
              }
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 50,
              columnNumber: 7
            }
          })), driver = _createDriver4.driver;
          _context5.t0 = expect;
          _context5.next = 4;
          return driver.indicationExists();
        case 4:
          _context5.t1 = _context5.sent;
          (0, _context5.t0)(_context5.t1).toBe(true);
        case 6:
        case "end":
          return _context5.stop();
      }
    }, _callee5);
  })));
  it('should render custom indication', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
    var _createDriver5, driver;
    return _regeneratorRuntime.wrap(function _callee6$(_context6) {
      while (1) switch (_context6.prev = _context6.next) {
        case 0:
          _createDriver5 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            customIndication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 58,
                columnNumber: 33
              }
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 58,
              columnNumber: 7
            }
          })), driver = _createDriver5.driver;
          _context6.t0 = expect;
          _context6.next = 4;
          return driver.customIndicationExists();
        case 4:
          _context6.t1 = _context6.sent;
          (0, _context6.t0)(_context6.t1).toBe(true);
        case 6:
        case "end":
          return _context6.stop();
      }
    }, _callee6);
  })));
  it('should render indication onHover', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
    var _createDriver6, driver;
    return _regeneratorRuntime.wrap(function _callee7$(_context7) {
      while (1) switch (_context7.prev = _context7.next) {
        case 0:
          _createDriver6 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            showIndicationOnHover: true,
            indication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 66,
                columnNumber: 49
              }
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 66,
              columnNumber: 7
            }
          })), driver = _createDriver6.driver;
          _context7.t0 = expect;
          _context7.next = 4;
          return driver.indicationExists();
        case 4:
          _context7.t1 = _context7.sent;
          (0, _context7.t0)(_context7.t1).toBe(false);
          _context7.next = 8;
          return driver.hover();
        case 8:
          _context7.t2 = expect;
          _context7.next = 11;
          return driver.indicationExists();
        case 11:
          _context7.t3 = _context7.sent;
          (0, _context7.t2)(_context7.t3).toBe(true);
        case 13:
        case "end":
          return _context7.stop();
      }
    }, _callee7);
  })));
  it('should render custom indication onHover', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
    var _createDriver7, driver;
    return _regeneratorRuntime.wrap(function _callee8$(_context8) {
      while (1) switch (_context8.prev = _context8.next) {
        case 0:
          _createDriver7 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            showIndicationOnHover: true,
            customIndication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 80,
                columnNumber: 27
              }
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 78,
              columnNumber: 7
            }
          })), driver = _createDriver7.driver;
          _context8.t0 = expect;
          _context8.next = 4;
          return driver.customIndicationExists();
        case 4:
          _context8.t1 = _context8.sent;
          (0, _context8.t0)(_context8.t1).toBe(false);
          _context8.next = 8;
          return driver.hover();
        case 8:
          _context8.t2 = expect;
          _context8.next = 11;
          return driver.customIndicationExists();
        case 11:
          _context8.t3 = _context8.sent;
          (0, _context8.t2)(_context8.t3).toBe(true);
        case 13:
        case "end":
          return _context8.stop();
      }
    }, _callee8);
  })));
  it('should render only custom indication if given both', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
    var _createDriver8, driver;
    return _regeneratorRuntime.wrap(function _callee9$(_context9) {
      while (1) switch (_context9.prev = _context9.next) {
        case 0:
          _createDriver8 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            indication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 94,
                columnNumber: 21
              }
            }),
            customIndication: /*#__PURE__*/React.createElement(PhotoCamera, {
              size: 24,
              __self: _this,
              __source: {
                fileName: _jsxFileName,
                lineNumber: 95,
                columnNumber: 27
              }
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 93,
              columnNumber: 7
            }
          })), driver = _createDriver8.driver;
          _context9.t0 = expect;
          _context9.next = 4;
          return driver.indicationExists();
        case 4:
          _context9.t1 = _context9.sent;
          (0, _context9.t0)(_context9.t1).toBe(false);
          _context9.t2 = expect;
          _context9.next = 9;
          return driver.customIndicationExists();
        case 9:
          _context9.t3 = _context9.sent;
          (0, _context9.t2)(_context9.t3).toBe(true);
        case 11:
        case "end":
          return _context9.stop();
      }
    }, _callee9);
  })));
  it('For size < 30, using name prop, text content should be 1 character', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
    var _createDriver9, driver24, _createDriver0, driver18;
    return _regeneratorRuntime.wrap(function _callee0$(_context0) {
      while (1) switch (_context0.prev = _context0.next) {
        case 0:
          _createDriver9 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            size: "size24",
            name: "John Doe",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 105,
              columnNumber: 7
            }
          })), driver24 = _createDriver9.driver;
          _createDriver0 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            size: "size18",
            name: "John Doe",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 108,
              columnNumber: 7
            }
          })), driver18 = _createDriver0.driver;
          _context0.t0 = expect;
          _context0.next = 5;
          return driver24.getTextContent();
        case 5:
          _context0.t1 = _context0.sent;
          (0, _context0.t0)(_context0.t1).toBe('J');
          _context0.t2 = expect;
          _context0.next = 10;
          return driver18.getTextContent();
        case 10:
          _context0.t3 = _context0.sent;
          (0, _context0.t2)(_context0.t3).toBe('J');
        case 12:
        case "end":
          return _context0.stop();
      }
    }, _callee0);
  })));
  it('For size >= 30, using name prop with space, text content should be 2 characters', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1() {
    var _createDriver1, driver30, _createDriver10, driver48;
    return _regeneratorRuntime.wrap(function _callee1$(_context1) {
      while (1) switch (_context1.prev = _context1.next) {
        case 0:
          _createDriver1 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            size: "size30",
            name: "John Doe",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 116,
              columnNumber: 7
            }
          })), driver30 = _createDriver1.driver;
          _createDriver10 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            size: "size48",
            name: "John Doe",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 119,
              columnNumber: 7
            }
          })), driver48 = _createDriver10.driver;
          _context1.t0 = expect;
          _context1.next = 5;
          return driver30.getTextContent();
        case 5:
          _context1.t1 = _context1.sent;
          (0, _context1.t0)(_context1.t1).toBe('JD');
          _context1.t2 = expect;
          _context1.next = 10;
          return driver48.getTextContent();
        case 10:
          _context1.t3 = _context1.sent;
          (0, _context1.t2)(_context1.t3).toBe('JD');
        case 12:
        case "end":
          return _context1.stop();
      }
    }, _callee1);
  })));
  it('For size < 48, with loading should not show loader', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
    var _createDriver11, driver30;
    return _regeneratorRuntime.wrap(function _callee10$(_context10) {
      while (1) switch (_context10.prev = _context10.next) {
        case 0:
          _createDriver11 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            loading: true,
            size: "size30",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 126,
              columnNumber: 47
            }
          })), driver30 = _createDriver11.driver;
          _context10.t0 = expect;
          _context10.next = 4;
          return driver30.isLoading();
        case 4:
          _context10.t1 = _context10.sent;
          (0, _context10.t0)(_context10.t1).toBe(false);
        case 6:
        case "end":
          return _context10.stop();
      }
    }, _callee10);
  })));
  it('For size >= 48, with loading should show loader', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
    var _createDriver12, driver48;
    return _regeneratorRuntime.wrap(function _callee11$(_context11) {
      while (1) switch (_context11.prev = _context11.next) {
        case 0:
          _createDriver12 = createDriver(/*#__PURE__*/React.createElement(Avatar, {
            loading: true,
            size: "size48",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 131,
              columnNumber: 47
            }
          })), driver48 = _createDriver12.driver;
          _context11.t0 = expect;
          _context11.next = 4;
          return driver48.isLoading();
        case 4:
          _context11.t1 = _context11.sent;
          (0, _context11.t0)(_context11.t1).toBe(true);
        case 6:
        case "end":
          return _context11.stop();
      }
    }, _callee11);
  })));
});