"use strict";

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

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

var styles = {
  componentId: 'cSfbM',
  template: function template(theme) {
    return "\n\n.cSfbM_ffKt{background-color:".concat(theme.DnDZoneBackgroundColor || 'inherit', ";border:").concat(theme.DnDZoneBorderWidth || 'inherit', " dashed ").concat(theme.DnDZoneBorderColor || 'inherit', ";display:flex;padding:").concat(theme.DnDZonePadding || 'inherit', "}\n\n.cSfbM_ffKt,.cSfbM_dDZW{justify-content:center;width:100%}\n\n.cSfbM_dDZW{background-color:").concat(theme.sidebarDnDZoneBackgroundColor || 'inherit', ";border:").concat(theme.sidebarDnDZoneBorderWidth || 'inherit', " dashed ").concat(theme.sidebarDnDZoneBorderColor || 'inherit', ";color:").concat(theme.sidebarDnDZoneColor || 'inherit', ";margin:").concat(theme.sidebarDnDZoneMargin || 'inherit', ";padding:").concat(theme.sidebarDnDZonePadding || 'inherit', ";text-align:center}\n\n[dir=ltr] .cSfbM_dDZW,[dir=rtl] .cSfbM_dDZW{text-align:center}\n\n.cSfbM_dDZW.cSfbM_baAw{margin-left:10%;width:90%}\n\n.cSfbM_gasz{display:flex;flex:1 0 100%;justify-content:center;width:100%}\n\n.cSfbM_bBLs{display:none;width:100%}");
  },
  'DnDZone': 'cSfbM_ffKt',
  'sidebarDnDZone': 'cSfbM_dDZW',
  'inSidebarStimulus': 'cSfbM_baAw',
  'wrapper': 'cSfbM_gasz',
  'hide': 'cSfbM_bBLs'
};
describe('DragAndDropZone', function () {
  var testbed = createTestbed(_index.default, {});
  shouldRenderComponent(testbed, {}, _index.default);
  describe('#shouldRender', function () {
    it('does not render when in sidebar if not open', function () {
      testbed.render({
        inSidebar: true,
        sidebarOpen: false
      });
      var dndZone = testbed.findChildrenByClass(styles.hide);
      expect(dndZone).to.not.be.empty();
    });
    context('in stimulus', function () {
      it('renders above when supposed to', function () {
        testbed.render({
          location: 'above',
          inStimulus: true,
          draggingOver: true,
          draggingAboveHalf: true,
          dropIntoEmptyStimulus: false
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.be.empty();
      });
      it('does not render above when not supposed to', function () {
        testbed.render({
          location: 'above',
          inStimulus: true,
          draggingOver: false,
          draggingAboveHalf: true,
          dropIntoEmptyStimulus: false
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.not.be.empty();
      });
      it('renders below when supposed to', function () {
        testbed.render({
          location: 'below',
          inStimulus: true,
          draggingOver: true,
          draggingAboveHalf: false,
          dropIntoEmptyStimulus: false
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.be.empty();
      });
      it('does not render below when not supposed to', function () {
        testbed.render({
          location: 'below',
          inStimulus: true,
          draggingOver: false,
          draggingAboveHalf: true,
          dropIntoEmptyStimulus: false
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.not.be.empty();
      });
      it('renders in when supposed to', function () {
        testbed.render({
          location: 'in',
          inStimulus: true,
          draggingOver: true,
          dropIntoEmptyStimulus: true
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.be.empty();
      });
      it('does not render in when not supposed to', function () {
        testbed.render({
          location: 'in',
          inStimulus: true,
          draggingOver: true,
          dropIntoEmptyStimulus: false
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.not.be.empty();
      });
    });
    context('not in stimulus', function () {
      it('renders above when supposed to', function () {
        testbed.render({
          location: 'above',
          draggingOver: true,
          draggingAboveHalf: true
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.be.empty();
      });
      it('does not render above when not supposed to', function () {
        testbed.render({
          location: 'above',
          draggingOver: false,
          draggingAboveHalf: true
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.not.be.empty();
      });
      it('renders below when supposed to', function () {
        testbed.render({
          location: 'below',
          draggingOver: true,
          draggingAboveHalf: false
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.be.empty();
      });
      it('does not render below when not supposed to', function () {
        testbed.render({
          location: 'below',
          draggingOver: false,
          draggingAboveHalf: true
        });
        var dndZone = testbed.findChildrenByClass(styles.hide);
        expect(dndZone).to.not.be.empty();
      });
    });
  });
  describe('a11y tests', function () {
    it('should meet a11y standards', function (done) {
      testbed.render();
      testbed.checkA11yStandards(done, {
        ignores: ['label', 'label-title-only']
      });
    });
  });
});