UNPKG

wix-style-react

Version:
74 lines (71 loc) 3.82 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.floatingHelperContentUniDriverFactory = 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 floatingHelperContentUniDriverFactory = (base, body) => { var title = (0, _unidriver.findByHook)(body, _constants.dataHooks.title); var floatingHelperBody = (0, _unidriver.findByHook)(body, _constants.dataHooks.body); var image = (0, _unidriver.findByHook)(body, _constants.dataHooks.image); var actionButton = (0, _unidriver.findByHook)(body, _constants.dataHooks.actionButton); var footer = (0, _unidriver.findByHook)(body, _constants.dataHooks.footer); return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base, body)), {}, { /** checks if title exists */ hasTitle: () => title.exists(), /** checks if text content exists */ hasBody: () => floatingHelperBody.exists(), /** checks if the action button exists */ hasActionButton: () => actionButton.exists(), /** checks if the footer exists */ hasFooter: () => footer.exists(), /** checks if an image exists */ hasImage: () => image.exists(), /** Get image HTML element*/ getImage: function () { var _getImage = (0, _asyncToGenerator2.default)(function* () { return (yield image.exists()) && (yield image.getNative()).children[0]; }); function getImage() { return _getImage.apply(this, arguments); } return getImage; }(), // eslint-disable-line no-restricted-properties /** Get footer HTML element*/ getFooter: function () { var _getFooter = (0, _asyncToGenerator2.default)(function* () { return (yield footer.exists()) && (yield footer.getNative()).children[0]; }); function getFooter() { return _getFooter.apply(this, arguments); } return getFooter; }(), // eslint-disable-line no-restricted-properties /** Get the text content of the title */ getTitleContent: () => title.text(), /** Get the text content of the helper's text */ getBodyContent: () => floatingHelperBody.text(), /** Get text of action button */ getActionButtonText: () => actionButton.text(), /** click on the action button */ clickActionButton: () => actionButton.click(), /** Returns direction property value */ getDirection: function () { var _getDirection = (0, _asyncToGenerator2.default)(function* () { return yield base.attr('data-direction'); }); function getDirection() { return _getDirection.apply(this, arguments); } return getDirection; }() }); }; exports.floatingHelperContentUniDriverFactory = floatingHelperContentUniDriverFactory; //# sourceMappingURL=FloatingHelperContent.uni.driver.js.map