UNPKG

wix-style-react

Version:
75 lines (74 loc) 3.77 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.avatarGroupDriverFactory = void 0; var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _unidriver = require("../test-utils/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 avatarGroupDriverFactory = (base, body) => { return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base, body)), {}, { /** * Gets the number Of displayed Avatars * @returns {Promise<number>} */ getVisibleAvatarsCount: function () { var _getVisibleAvatarsCount = (0, _asyncToGenerator2.default)(function* () { var numberOfAvatars = yield (0, _unidriver.countByHook)(base, _constants.dataHooks.avatarGroupItem); var isMoreIndicatorExist = yield (yield (0, _unidriver.findByHook)(base, _constants.dataHooks.avatarGroupMoreItem)).exists(); if (isMoreIndicatorExist) { numberOfAvatars++; } return numberOfAvatars; }); function getVisibleAvatarsCount() { return _getVisibleAvatarsCount.apply(this, arguments); } return getVisibleAvatarsCount; }(), /** * Gets the text content * @param {number} index Avatar index * @returns {Promise<string>} */ getVisibleAvatarTextContentByIndex: function () { var _getVisibleAvatarTextContentByIndex = (0, _asyncToGenerator2.default)(function* (index) { return yield (0, _unidriver.findByHookAtIndex)(base, _constants.dataHooks.avatarGroupItem, index).text(); }); function getVisibleAvatarTextContentByIndex(_x) { return _getVisibleAvatarTextContentByIndex.apply(this, arguments); } return getVisibleAvatarTextContentByIndex; }(), /** * Gets the moreIndicator content * @returns {Promise<string>} */ getMoreIndicatorContent: function () { var _getMoreIndicatorContent = (0, _asyncToGenerator2.default)(function* () { return yield (yield (0, _unidriver.findByHook)(base, _constants.dataHooks.avatarGroupMoreItem)).text(); }); function getMoreIndicatorContent() { return _getMoreIndicatorContent.apply(this, arguments); } return getMoreIndicatorContent; }(), /** * Checks whether the moreIndicatior exists * @returns {Promise<boolean>} */ isMoreIndicatorExist: function () { var _isMoreIndicatorExist = (0, _asyncToGenerator2.default)(function* () { return yield (yield (0, _unidriver.findByHook)(base, _constants.dataHooks.avatarGroupMoreItem)).exists(); }); function isMoreIndicatorExist() { return _isMoreIndicatorExist.apply(this, arguments); } return isMoreIndicatorExist; }() }); }; exports.avatarGroupDriverFactory = avatarGroupDriverFactory; //# sourceMappingURL=AvatarGroup.uni.driver.js.map