wix-style-react
Version:
63 lines (51 loc) • 2.69 kB
JavaScript
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _regeneratorRuntime from "@babel/runtime/regenerator";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
import inputWithOptionsDriverFactory from '../InputWithOptions/InputWithOptions.protractor.driver';
var multiSelectDriverFactory = function multiSelectDriverFactory(component) {
return _objectSpread(_objectSpread({}, inputWithOptionsDriverFactory(component)), {}, {
/** add a tag for the first item in the options */
addTag: function () {
var _addTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return component.click();
case 2:
_context.next = 4;
return inputWithOptionsDriverFactory(component).selectOptionAt(0);
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
function addTag() {
return _addTag.apply(this, arguments);
}
return addTag;
}(),
/** return the element */
element: function element() {
return component;
},
/** returns the element height in px */
getHeight: function getHeight() {
return component.getSize().then(function (size) {
return size.height;
});
},
/** returns the element width in px */
getWidth: function getWidth() {
return component.getSize().then(function (size) {
return size.width;
});
}
});
};
export default multiSelectDriverFactory;