"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.skeletonUniDriverFactory = void 0;
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _unidriver = require("../utils/test-utils/unidriver");
var _constants = require("./constants");
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) { (0, _defineProperty2.default)(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; }
var skeletonUniDriverFactory = (base, body) => {
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base, body)), {}, {
    /** return number of lines rendered */
    getNumLines: () => base.$$("[data-hook=\"".concat(_constants.dataHooks.line, "\"]")).count(),
    /** return boolean representing whether given spacing is rendered */
    hasSpacing: function () {
      var _hasSpacing = (0, _asyncToGenerator2.default)(function* (spacing) {
        return (yield base.attr('data-spacing')) === spacing;
      });
      function hasSpacing(_x) {
        return _hasSpacing.apply(this, arguments);
      }
      return hasSpacing;
    }(),
    /** return boolean representing whether given list of sizes is rendered */
    hasSizes: function () {
      var _hasSizes = (0, _asyncToGenerator2.default)(function* (sizes) {
        var assertions = yield base.$$("[data-hook=\"".concat(_constants.dataHooks.chunk, "\"]")).map(/*#__PURE__*/function () {
          var _ref = (0, _asyncToGenerator2.default)(function* (chunkElement, i) {
            return (yield chunkElement.attr('data-size')) === sizes[i];
          });
          return function (_x3, _x4) {
            return _ref.apply(this, arguments);
          };
        }());
        return assertions.every(Boolean);
      });
      function hasSizes(_x2) {
        return _hasSizes.apply(this, arguments);
      }
      return hasSizes;
    }(),
    /** return boolean representing whether given alignment is rendered */
    hasAlignment: function () {
      var _hasAlignment = (0, _asyncToGenerator2.default)(function* (alignment) {
        return (yield base.attr('data-alignment')) === alignment;
      });
      function hasAlignment(_x5) {
        return _hasAlignment.apply(this, arguments);
      }
      return hasAlignment;
    }()
  });
};
exports.skeletonUniDriverFactory = skeletonUniDriverFactory;
//# sourceMappingURL=Skeleton.uni.driver.js.map