"use strict";

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

var _Tooltip = _interopRequireDefault(require("@instructure/ui-overlays/lib/components/Tooltip"));

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

describe('Common Stimulus Sidebar Title Presenter', function () {
  var props = {
    sidebarOpen: true,
    title: 'This is a title'
  };
  var testbed = createTestbed(_index.default, props);
  describe('#renderTitle', function () {
    it('should render html content as html', function () {
      var title = '<div>Hello</div>';
      testbed.render({
        title: title
      });
      expect(testbed.getText()).include(title);
    });
    it('renders a tooltip component if title is longer than 80 chars', function () {
      testbed.render({
        title: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula and more'
      });
      expect(testbed.findChildrenByType(_Tooltip.default).length).to.eq(1);
    });
    it('does not render a tooltip component if title is shorter than 80 chars', function () {
      testbed.render({
        title: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
      });
      expect(testbed.findChildrenByType(_Tooltip.default).length).to.eq(0);
    });
  });
  describe('a11y tests', function () {
    it('should meet a11y standards', function (done) {
      testbed.render();
      testbed.checkA11yStandards(done);
    });
  });
});