"use strict";

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

var _reactDom = _interopRequireDefault(require("react-dom"));

var _chai = _interopRequireDefault(require("chai"));

var _spinner = _interopRequireDefault(require("../../spinner"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

_chai.default.should();

describe('Spinner: ', function () {
  // Setup and takedown
  var renderSpinner = function renderSpinner(instance) {
    return function () {
      this.dom = document.createElement('div');
      document.body.appendChild(this.dom);
      this.component = _reactDom.default.render(instance, this.dom);
    };
  };

  function removeSpinner() {
    _reactDom.default.unmountComponentAtNode(this.dom);

    document.body.removeChild(this.dom);
  }

  var getSpinner = function getSpinner(dom) {
    return dom.querySelector('.slds-spinner');
  }; // Tests


  describe('Default spinner renders properly', function () {
    before(renderSpinner(_react.default.createElement(_spinner.default, null)));
    after(removeSpinner);
    it('Spinner exists', function () {
      var spinner = getSpinner(this.dom);
      spinner.should.not.be.undefined;
    });
    it('renders default classes when no props passed in', function () {
      var spinner = getSpinner(this.dom);
      spinner.className.should.equal('slds-spinner slds-spinner_medium');
    });
  });
  describe('Props render proper css classes', function () {
    beforeEach(renderSpinner(_react.default.createElement(_spinner.default, {
      size: "small",
      variant: "brand",
      isDelayed: true
    })));
    afterEach(removeSpinner);
    it('renders correct classes when props passed in', function () {
      var spinner = getSpinner(this.dom);
      spinner.className.should.include('slds-spinner_brand slds-spinner_delayed slds-spinner_small');
    });
  });
});