UNPKG

wix-style-react

Version:
94 lines (81 loc) 3.82 kB
var _this = this; function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } var tableDriverFactory = function () { var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(component, page) { var tableContent; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return component.$('[data-hook="table-content"]'); case 2: tableContent = _context3.sent; return _context3.abrupt('return', { element: function element() { return component; }, exists: function () { var _ref2 = _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; case 2: return _context.abrupt('return', !!_context.sent); case 3: case 'end': return _context.stop(); } } }, _callee, _this); })); return function exists() { return _ref2.apply(this, arguments); }; }(), getCellTextValue: function () { var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var cell; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return tableContent.$('[data-table-row]:nth-child(' + (row + 1) + ') td:nth-child(' + (column + 1) + ')'); case 2: cell = _context2.sent; _context2.next = 5; return page.evaluate(function (_cell) { return _cell.innerText; }, cell); case 5: return _context2.abrupt('return', _context2.sent); case 6: case 'end': return _context2.stop(); } } }, _callee2, _this); })); return function getCellTextValue() { return _ref3.apply(this, arguments); }; }() }); case 4: case 'end': return _context3.stop(); } } }, _callee3, _this); })); return function tableDriverFactory(_x, _x2) { return _ref.apply(this, arguments); }; }(); export default tableDriverFactory;