"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _react = _interopRequireDefault(require("react"));

var _index = _interopRequireDefault(require("../index"));

var styles = {
  componentId: 'epout',
  template: function template(theme) {
    return "\n\n.epout_bgqc{padding-bottom:".concat(theme.alertPadding || 'inherit', ";position:inherit;z-index:").concat(theme.alertZIndex || 'inherit', "}\n\n.epout_etBv{display:block}\n\n.epout_crZr{padding:").concat(theme.containerPadding || 'inherit', ";position:relative}\n\n.epout_oqJC{background-color:").concat(theme.disabledChildrenBackgroundColor || 'inherit', ";bottom:0;left:0;opacity:").concat(theme.disabledChildrenOpacity || 'inherit', ";position:absolute;right:0;top:0;z-index:").concat(theme.disabledChildrenZIndex || 'inherit', "}");
  },
  'alert': 'epout_bgqc',
  'alertContent': 'epout_etBv',
  'container': 'epout_crZr',
  'disabledChildren': 'epout_oqJC'
};

var _ref =
/*#__PURE__*/
_react.default.createElement("button", null);

describe('Item Warning Wrapper', function () {
  var cancelActionCallback = sinon.stub();
  var defaultActionCallback = sinon.stub();
  var testbed = createTestbed(_index.default, {
    cancelActionCallback: cancelActionCallback,
    children: _ref,
    defaultActionCallback: defaultActionCallback,
    description: 'description',
    hideActions: true,
    showAlert: true
  });
  describe('#render', function () {
    it('renders the wrapper', function () {
      var shallowTestbed = testbed.renderShallowly();
      var alert = shallowTestbed.find('Alert');
      expect(alert).to.have.length(1);
    });
    it('renders the children content', function () {
      var shallowTestbed = testbed.renderShallowly();
      var button = shallowTestbed.find('button');
      expect(button).to.have.length(1);
    });
    it('renders the action buttons', function () {
      var shallowTestbed = testbed.renderShallowly({
        hideActions: false
      });
      var button = shallowTestbed.find('Button');
      expect(button).to.have.length(2);
    });
    it('hides children', function () {
      var shallowTestbed = testbed.renderShallowly({
        disableChildren: true
      });
      var overlay = shallowTestbed.find(styles.disabledChildren);
      expect(overlay).to.not.be.undefined();
    });
    it('hides alert', function () {
      var shallowTestbed = testbed.renderShallowly({
        showAlert: false
      });
      var alert = shallowTestbed.find('Alert');
      expect(alert).to.have.length(0);
    });
    it('sets focus on first interactive element', function () {
      testbed.render({
        hideActions: false
      });
      expect(document.activeElement.tagName).to.equal('BUTTON');
    });
  });
});