UNPKG

wix-style-react

Version:
101 lines (100 loc) 5.39 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.testimonialListDriverFactory = 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"); var _TextUni = require("../Text/Text.uni.driver"); 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 testimonialListDriverFactory = (base, body) => { return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base, body)), {}, { /** * Gets the number of the testimonials that exist in the footer * @returns {Promise<number>} */ getNumberOfTestimonials: function () { var _getNumberOfTestimonials = (0, _asyncToGenerator2.default)(function* () { return (0, _unidriver.countByHook)(base, _constants.dataHooks.testimonial); }); function getNumberOfTestimonials() { return _getNumberOfTestimonials.apply(this, arguments); } return getNumberOfTestimonials; }(), /** * Checks whether testimonial's avatar exist * @param {number} testimonialIndex - the index of the testimonial in the testimonials array (starts from 0). * @returns {Promise<boolean>} */ hasTestimonialAvatar: function () { var _hasTestimonialAvatar = (0, _asyncToGenerator2.default)(function* (testimonialIndex) { return yield (0, _unidriver.findByHook)(base, "".concat(_constants.dataHooks.testimonialAvatar).concat(testimonialIndex)).exists(); }); function hasTestimonialAvatar(_x) { return _hasTestimonialAvatar.apply(this, arguments); } return hasTestimonialAvatar; }(), /** * Checks whether testimonial's text exist * @param {number} testimonialIndex - the index of the testimonial in the testimonials array (starts from 0). * @returns {Promise<boolean>} */ hasTestimonialText: function () { var _hasTestimonialText = (0, _asyncToGenerator2.default)(function* (testimonialIndex) { return yield (0, _unidriver.findByHook)(base, "".concat(_constants.dataHooks.testimonialText).concat(testimonialIndex)).exists(); }); function hasTestimonialText(_x2) { return _hasTestimonialText.apply(this, arguments); } return hasTestimonialText; }(), /** * Gets the testimonial's text * @param {number} testimonialIndex - the index of the testimonial in the testimonials array (starts from 0). * @returns {Promise<string>} */ getTestimonialText: function () { var _getTestimonialText = (0, _asyncToGenerator2.default)(function* (testimonialIndex) { return (yield (0, _TextUni.textUniDriverFactory)(yield (0, _unidriver.findByHook)(base, "".concat(_constants.dataHooks.testimonialText).concat(testimonialIndex)))).getText(); }); function getTestimonialText(_x3) { return _getTestimonialText.apply(this, arguments); } return getTestimonialText; }(), /** * Checks whether testimonial's author name exist * @param {number} testimonialIndex - the index of the testimonial in the testimonials array (starts from 0). * @returns {Promise<boolean>} */ hasTestimonialAuthorName: function () { var _hasTestimonialAuthorName = (0, _asyncToGenerator2.default)(function* (testimonialIndex) { return yield (0, _unidriver.findByHook)(base, "".concat(_constants.dataHooks.testimonialAuthorName).concat(testimonialIndex)).exists(); }); function hasTestimonialAuthorName(_x4) { return _hasTestimonialAuthorName.apply(this, arguments); } return hasTestimonialAuthorName; }(), /** * Gets the testimonial's author name * @param {number} testimonialIndex - the index of the testimonial in the testimonials array (starts from 0). * @returns {Promise<string>} */ getTestimonialAuthorName: function () { var _getTestimonialAuthorName = (0, _asyncToGenerator2.default)(function* (testimonialIndex) { return (yield (0, _TextUni.textUniDriverFactory)(yield (0, _unidriver.findByHook)(base, "".concat(_constants.dataHooks.testimonialAuthorName).concat(testimonialIndex)))).getText(); }); function getTestimonialAuthorName(_x5) { return _getTestimonialAuthorName.apply(this, arguments); } return getTestimonialAuthorName; }() }); }; exports.testimonialListDriverFactory = testimonialListDriverFactory; //# sourceMappingURL=TestimonialList.uni.driver.js.map