"use strict";

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

var _FileSelector = _interopRequireDefault(require("../FileSelector"));

var styles = {
  componentId: 'flcWS',
  template: function template(theme) {
    return "\n\n.file_selector__styles__dropzone {\n  background-color: ".concat(theme.dropzoneBackgroundColor || 'inherit', ";\n  border: ").concat(theme.dropzoneBorderWidth || 'inherit', " dashed ").concat(theme.dropzoneBorderColor || 'inherit', ";\n  cursor: pointer;\n  padding: ").concat(theme.dropzonePadding || 'inherit', ";\n}\n");
  },
  'dropzone': 'file_selector__styles__dropzone'
};
describe('FileSelector', function () {
  var testbed = createTestbed(_FileSelector.default, {
    acceptAttribute: '.zip',
    content: 'Content'
  });
  shouldRenderComponent(testbed, {}, _FileSelector.default);
  describe('#onDrop', function () {
    it('calls the fileHandler with the list of files', function () {
      var fileHandlerStub = sinon.stub();
      testbed.render({
        fileHandler: fileHandlerStub
      });
      testbed.subject.onDrop(['testfile1', 'testfile2']);
      var filesList = fileHandlerStub.getCall(0).args[0].toJS();
      expect(filesList[0]).to.eq('testfile1');
      expect(filesList[1]).to.eq('testfile2');
    });
  });
  describe('rendering', function () {
    it('should render a file selection box', function () {
      testbed.render({});
      var dropzones = testbed.findChildrenByClass(styles.dropzone);
      expect(dropzones.length).to.be.equal(1);
    });
    it('should render an input', function () {
      testbed.render({});
      var input = testbed.rootNode.getElementsByTagName('input')[0];
      expect(input.type).to.be.equal('file');
      expect(input.accept).to.be.equal('.zip');
      expect(testbed.getText()).to.be.equal('Content');
    });
  });
  describe('a11y tests', function () {
    it('should meet a11y standards', function (done) {
      testbed.render({});
      testbed.checkA11yStandards(done);
    });
  });
});