"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.DragAndDropZone__styles__DnDZone { \n  border: ".concat(theme.DnDZoneBorderWidth || 'inherit', " dashed ").concat(theme.DnDZoneBorderColor || 'inherit', ";\n  background-color: ").concat(theme.DnDZoneBackgroundColor || 'inherit', ";\n  padding: ").concat(theme.DnDZonePadding || 'inherit', ";\n  display: flex;\n  justify-content: center;\n  width: 100%;\n}\n\n.DragAndDropZone__styles__sidebarDnDZone {\n  border: ").concat(theme.sidebarDnDZoneBorderWidth || 'inherit', " dashed ").concat(theme.sidebarDnDZoneBorderColor || 'inherit', ";\n  background-color: ").concat(theme.sidebarDnDZoneBackgroundColor || 'inherit', ";\n  padding: ").concat(theme.sidebarDnDZonePadding || 'inherit', ";\n  margin: ").concat(theme.sidebarDnDZoneMargin || 'inherit', ";\n  color: ").concat(theme.sidebarDnDZoneColor || 'inherit', ";\n  justify-content: center;\n  text-align: center;\n  width: 100%;\n}\n\n[dir=\"ltr\"] .DragAndDropZone__styles__sidebarDnDZone {\n  text-align: center;\n}\n\n[dir=\"rtl\"] .DragAndDropZone__styles__sidebarDnDZone {\n  text-align: center;\n}\n\n.DragAndDropZone__styles__sidebarDnDZone.DragAndDropZone__styles__inSidebarStimulus {\n  margin-left: 10%;\n  width: 90%;\n}\n\n.DragAndDropZone__styles__wrapper {\n  justify-content: center;\n  display: flex;\n  flex: 1 0 100%;\n  width: 100%;\n}\n\n.DragAndDropZone__styles__hide {\n  display: none;\n  width: 100%;\n}\n");
  },
  'DnDZone': 'DragAndDropZone__styles__DnDZone',
  'sidebarDnDZone': 'DragAndDropZone__styles__sidebarDnDZone',
  'inSidebarStimulus': 'DragAndDropZone__styles__inSidebarStimulus',
  'wrapper': 'DragAndDropZone__styles__wrapper',
  'hide': 'DragAndDropZone__styles__hide'
};
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']
      });
    });
  });
});