"use strict";

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

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

var _enzyme = require("enzyme");

var _ = _interopRequireDefault(require("."));

var _local = _interopRequireDefault(require("./local.json"));

describe('SideBar', function () {
  var current = 'uip';
  var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
    activeDoc: current,
    categories: _local["default"]
  }));
  var sections = node.find('SideBarSection');
  it('Renders lists for each sections.', function () {
    var expectation = _local["default"].length;
    expect(sections).toHaveLength(expectation);
    expect(sections.find('h3:first-child')).toHaveLength(expectation);
    expect(sections.find('h3 + SideBarList')).toHaveLength(expectation);
  });
  it('Styles the current active page item.', function () {
    var active = node.find('.active');
    expect(active).toHaveLength(1);
    expect(active.getDOMNode().href).toContain(current);
  });
  it('Displays deep lists for subpages.', function () {
    expect(sections.find('ul ul')).toHaveLength(1);
  });
  it('Opens external links in a new tab.', function () {
    expect(sections.find('li > a[target="_blank"]').text()).toBe('Road Map');
    expect(sections.find('li > a[target="_blank"]')).toHaveLength(1);
  });
});