"use strict";

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

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

var styles = {
  componentId: 'fGOwX',
  template: function template(theme) {
    return "\n\n.Legend__styles__containerColumn {\n  border: ".concat(theme.containerBorderWidth || 'inherit', " solid ").concat(theme.containerBorderColor || 'inherit', ";\n}\n\n.Legend__styles__containerRow {\n  margin: 0 calc(-1 * ").concat(theme.seriesContainerRowMargin || 'inherit', ");\n}\n\n.Legend__styles__seriesContainer {\n  flex-direction: row;\n  align-items: center;\n  margin: ").concat(theme.seriesContainerMargin || 'inherit', ";\n}\n\n.Legend__styles__containerColumn .Legend__styles__seriesContainer {\n  display: flex;\n}\n\n.Legend__styles__containerRow .Legend__styles__seriesContainer {\n  display: inline-flex;\n  padding: 0 ").concat(theme.seriesContainerRowMargin || 'inherit', ";\n}\n\n.Legend__styles__seriesSwatchContainer {\n  width: 1.2rem;\n  height: 1.2rem;\n  margin-right: ").concat(theme.seriesSwatchMargin || 'inherit', ";\n  display: flex;\n}\n\n.Legend__styles__seriesSwatch {\n  flex: 1;\n}\n\n.Legend__styles__seriesLabel {\n  font-family: ").concat(theme.seriesLabelFontFamily || 'inherit', ";\n  font-size: ").concat(theme.seriesLabelFontSize || 'inherit', ";\n  white-space: nowrap;\n}\n");
  },
  'containerColumn': 'Legend__styles__containerColumn',
  'containerRow': 'Legend__styles__containerRow',
  'seriesContainer': 'Legend__styles__seriesContainer',
  'seriesSwatchContainer': 'Legend__styles__seriesSwatchContainer',
  'seriesSwatch': 'Legend__styles__seriesSwatch',
  'seriesLabel': 'Legend__styles__seriesLabel'
};
describe('Legend', function () {
  var testbed = createTestbed(_index.default, {
    series: [{
      className: 'redClass',
      label: 'Red'
    }, {
      className: 'blueClass',
      label: 'Blue'
    }]
  });
  it('renders each series', function () {
    testbed.render();
    var series = testbed.findChildrenByClass(styles.seriesContainer);
    expect(series).to.have.length(2);
    expect(testbed.getText(series[0])).to.include('Red');
    expect(testbed.findChildrenByClass('redClass')).to.have.length(1);
    expect(testbed.getText(series[1])).to.include('Blue');
    expect(testbed.findChildrenByClass('blueClass')).to.have.length(1);
  });
  it('applies containerRow class to row variant', function () {
    testbed.render({
      variant: 'row'
    });
    var series = testbed.findChildrenBySelector(".".concat(styles.containerRow, " .").concat(styles.seriesContainer));
    expect(series).to.have.length(2);
  });
});