"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _Input = _interopRequireDefault(require("../../Input/Input.driver"));
var editableRowDriverFactory = _ref => {
  var {
    element,
    eventTrigger
  } = _ref;
  var find = dataHook => element.querySelector("[data-hook=\"".concat(dataHook, "\"]"));
  var inputDriver = () => (0, _Input.default)({
    element: find('edit-row-input'),
    wrapper: element
  });
  return {
    exists: () => !!element,
    isInputFocused: () => inputDriver().isFocus(),
    clickApprove: () => eventTrigger.click(find('edit-row-approve-button')),
    isApproveDisabled: () => {
      var disabled = find('edit-row-approve-button').getAttribute('aria-disabled');
      return disabled === 'true';
    },
    clickCancel: () => eventTrigger.click(find('edit-row-cancel-button')),
    getText: () => inputDriver().getValue(),
    setText: text => inputDriver().enterText(text),
    keyDown: keyCode => inputDriver().trigger('keyDown', {
      keyCode
    })
  };
};
var _default = exports.default = editableRowDriverFactory;
//# sourceMappingURL=EditableRow.driver.js.map