"use strict";

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

var _Button = _interopRequireDefault(require("@instructure/ui-buttons/lib/components/Button"));

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

var styles = {
  componentId: 'yAmvo',
  template: function template(theme) {
    return "\n\n.ExpandButton__styles__icon {\n  transition: transform ".concat(theme.iconTransitionDuration || 'inherit', ";\n}\n\n.ExpandButton__styles__iconOpened {\n  transform: rotate3d(1, 0, 0, 180deg);\n}\n");
  },
  'icon': 'ExpandButton__styles__icon',
  'iconOpened': 'ExpandButton__styles__iconOpened'
};
describe('ExpandButton', function () {
  var clickStub = sinon.stub();
  var testbed = createTestbed(_index.default, {
    isExpanded: false,
    title: 'omg',
    onClick: clickStub
  });
  shouldRenderComponent(testbed, {}, _Button.default);
  it('should read title text', function () {
    testbed.render();
    expect(testbed.getText()).to.eq('omg');
  });
  it('triggers onClick', function () {
    testbed.render();
    var icon = testbed.findChildrenByTagName('button')[0];
    icon.click();
    expect(clickStub).to.be.calledOnce();
  });
  it('should render a flippy icon', function () {
    testbed.render();
    expect(testbed.findChildrenByClass(styles.iconOpened).length).to.eq(0);
    testbed.render({
      isExpanded: true
    });
    expect(testbed.findChildrenByClass(styles.iconOpened).length).to.eq(1);
  });
  describe('a11y tests', function () {
    it('should meet a11y standards', function (done) {
      testbed.render();
      testbed.checkA11yStandards(done);
    });
  });
});