"use strict";

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

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

describe('AddContentButton', function () {
  var onClickStub = sinon.stub();
  var defaultProps = {
    isEditing: false,
    onClick: onClickStub,
    position: 33,
    useStimulusTrigger: false
  };
  beforeEach(function () {
    onClickStub.resetHistory();
  });
  var testbed = createTestbed(_index.default, defaultProps);
  it('renders correctly for a non-stimulus', function () {
    testbed.render();
    expect(testbed.rootNode.innerHTML.match(/Add Content/)).to.exist();
    expect(testbed.rootNode.innerHTML.match(/Attach Question/)).to.not.exist();
  });
  it('renders correctly for a stimulus', function () {
    testbed.render({
      useStimulusTrigger: true
    });
    expect(testbed.rootNode.innerHTML.match(/Add Content/)).to.not.exist();
    expect(testbed.rootNode.innerHTML.match(/Attach Question/)).to.exist();
  });
  it('calls the onClick handler', function () {
    testbed.render();
    testbed.findChildrenByTagName('button')[0].click();
    expect(onClickStub.called).to.be.true();
  });
});