import React from 'react';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import SprkTable from './SprkTable';

Enzyme.configure({ adapter: new Adapter() });

it('should display a div element with the correct base class', () => {
  const wrapper = shallow(<SprkTable />);
  expect(wrapper.find('div.sprk-b-TableContainer').length).toBe(1);
});

it('should display a table element with the correct base class', () => {
  const wrapper = shallow(<SprkTable />);
  expect(wrapper.find('table.sprk-b-Table').length).toBe(1);
});

it('should display a table element with the correct classes if additionalTableClasses has a value', () => {
  const wrapper = shallow(<SprkTable additionalTableClasses="sprk-b-Table--secondary"/>);
  expect(wrapper.find('table').hasClass('sprk-b-Table')).toBe(true);
  expect(wrapper.find('table').hasClass('sprk-b-Table--secondary')).toBe(true);
});

it('should display a div element with the correct data-id if idString has a value', () => {
  const wrapper = shallow(<SprkTable idString="table-1"/>);
  expect(wrapper.find('div[data-id="table-1"]').length).toBe(1);
});

it('should display a div element with the correct classes if additionalClasses has a value', () => {
  const wrapper = shallow(<SprkTable additionalClasses="additionalClass" />);
  expect(wrapper.find('div').hasClass('sprk-b-TableContainer')).toBe(true);
  expect(wrapper.find('div').hasClass('additionalClass')).toBe(true);
});

it('should display a table element with the correct classes if the variant is secondary', () => {
  const wrapper = shallow(<SprkTable variant="secondary" />);
  expect(wrapper.find('table').hasClass('sprk-b-Table--secondary')).toBe(true);
})

it('should display a table element with the correct classes if the variant is grouped', () => {
  const wrapper = shallow(<SprkTable variant="grouped" />);
  expect(wrapper.find('table').hasClass('sprk-b-Table--grouped-columns')).toBe(true);
})

it('should display a table element with the correct classes if the variant is rowComparison', () => {
  const wrapper = shallow(<SprkTable variant="rowComparison" />);
  expect(wrapper.find('table').hasClass('sprk-b-Table--row-comparison')).toBe(true);
})

it('should display a table element with the correct classes if the variant is secondaryRowComparison', () => {
  const wrapper = shallow(<SprkTable variant="secondaryRowComparison" />);
  expect(wrapper.find('table').hasClass('sprk-b-Table--secondary-row-comparison')).toBe(true);
})
@@ -2475,28 +2475,1828 @@
 comparison')).toBe(true);%0A%7D)
+%0A%0Ait('should display a thead element with the correct class if the variant is default', () =%3E %7B%0A  const wrapper = shallow(%3CSprkTable variant='default' /%3E);%0A  expect(wrapper.find('thead').hasClass('sprk-b-Table__head')).toBe(true);%0A%7D)%0A%0Ait('should display a thead element with the correct class if the variant is secondary', () =%3E %7B%0A  const wrapper = shallow(%3CSprkTable variant='secondary' /%3E);%0A  expect(wrapper.find('thead').hasClass('sprk-b-Table__head')).toBe(true);%0A%7D)%0A%0Ait('should display a thead element with the correct class if the variant is grouped', () =%3E %7B%0A  const wrapper = shallow(%3CSprkTable variant='grouped' /%3E);%0A  expect(wrapper.find('thead').hasClass('sprk-b-Table__head')).toBe(true);%0A%7D)%0A%0Ait('should display a thead element with the correct class if the variant is rowComparison', () =%3E %7B%0A  const wrapper = shallow(%3CSprkTable variant='rowComparison' /%3E);%0A  expect(wrapper.find('thead').hasClass('sprk-b-Table__head')).toBe(true);%0A%7D)%0A%0Ait('should display one tr element in the thead element if columns are present', () =%3E %7B%0A  const wrapper = shallow(%3CSprkTable columns=%7B%5B %7Bname:'data1', header: 'Header 1'%7D, %7Bname:'data2', header: 'Header 2'%7D, %7Bname:'data3', header: 'Header 3'%7D %5D%7D/%3E);%0A  expect(wrapper.find('tr').length).toBe(1);%0A%7D)%0A%0Ait('should display multiple tr elements in the thead element if columns are present and the variant is grouped', () =%3E %7B%0A  const wrapper = shallow(%3CSprkTable variant=%22grouped%22 columns=%7B%5B %5B%7Bname: 'column1', header: 'Column Heading', rowspan: 2%7D, %7Bname: 'column2', header: 'Column Heading', colspan: 3%7D, %7Bname: 'column3', header: 'Column Heading', rowspan: 2%7D%5D, %5B%7Bname: 'subheading1', header: 'SubHeading'%7D, %7Bname: 'subheading2', header: 'SubHeading'%7D, %7Bname: 'subheading3', header: 'Subheading'%7D%5D %5D%7D /%3E);%0A  expect(wrapper.find('tr').length).toBe(2);%0A%7D)

add tests