"use strict";

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

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

var _testUtils = _interopRequireDefault(require("react-dom/test-utils"));

var _EditButton = _interopRequireDefault(require("../EditButton"));

describe('Quiz Info EditButton', function () {
  var testbed = createTestbed(withContext(_EditButton.default), {
    onClick: function onClick() {}
  });
  shouldRenderComponent(testbed, {}, _EditButton.default);
  describe('actions', function () {
    var clickStub = sinon.stub();
    it('should call onClick when clicked', function () {
      testbed.render({
        onClick: clickStub
      });

      var btn = _reactDom.default.findDOMNode(testbed.subject);

      _testUtils.default.Simulate.click(btn);

      expect(clickStub.called).to.be.true();
    });
  });
  describe('a11y tests', function () {
    it('should meet a11y standards', function (done) {
      testbed.render();
      testbed.checkA11yStandards(done, {});
    });
    describe('screenreader text', function () {
      it('should render default screenreader text', function () {
        testbed.render();
        expect(testbed.getText()).to.include('Edit');
      });
      it('should render screenreader text if prop passed in', function () {
        testbed.render({
          screenreaderText: 'Custom'
        });
        expect(testbed.getText()).to.include('Custom');
        expect(testbed.getText()).not.to.include('Edit');
      });
    });
  });
});