/**
 * brightwheel
 *
 * Copyright © 2016 Allen Smith &lt;loranallensmith@github.com&gt;. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import { expect } from 'chai';
import Table from '../src/table';

describe('Table', () => {

  describe('render method', () => {

    it('should create the right root element', () => {
      let myTable = new Table({}, [
        {
          id: 1,
          name: 'Type'
        }
      ]);
      expect(myTable.virtualElement.tagName).to.equal('TABLE');
    });

    it('should render headers', () => {
      let myTable = new Table({}, [
        {
          id: 1,
          name: 'Type'
        }
      ]);
      expect(myTable.virtualElement.children[0].tagName).to.equal('THEAD');
      expect(myTable.virtualElement.children[0].children[0].tagName).to.equal('TR');
      expect(myTable.virtualElement.children[0].children[0].children[0].tagName).to.equal('TH');
      expect(myTable.virtualElement.children[0].children[0].children[0].children[0].text).to.equal('id');
    });

    it('should render rows', () => {
      let myTable = new Table({}, [
        {
          id: 1,
          name: 'Type'
        }
      ]);
      expect(myTable.virtualElement.children[1].tagName).to.equal('TBODY');
      expect(myTable.virtualElement.children[1].children[0].tagName).to.equal('TR');
      expect(myTable.virtualElement.children[1].children[0].children[0].tagName).to.equal('TD');
      expect(myTable.virtualElement.children[1].children[0].children[0].children[0].text).to.equal('1')
    });

    it('should render striped tables', () => {
      let myTable = new Table({ striped: true }, [
        {
          id: 1,
          name: 'Type'
        }
      ]);
      expect(myTable.virtualElement.properties.className).to.contain('table-striped');
    });

    it('should include extra classes', () => {
      let myTable = new Table({ classNames:['extra-class', 'another-class'] }, [{
        id: 1,
        name: 'Type'
      }]);
      expect(myTable.virtualElement.properties.className).to.contain('extra-class another-class');
    });

  });

});

@@ -550,32 +550,25 @@
 ect(myTable.
-virtualE
+e
 lement.tagNa
@@ -762,32 +762,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -831,32 +831,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -909,32 +909,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -999,32 +999,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -1047,32 +1047,25 @@
 dren%5B0%5D.
-children%5B0%5D.text
+innerHTML
 ).to.equ
@@ -1243,32 +1243,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -1312,32 +1312,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -1390,32 +1390,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -1480,32 +1480,25 @@
 ect(myTable.
-virtualE
+e
 lement.child
@@ -1532,24 +1532,17 @@
 %5B0%5D.
-children%5B0%5D.text
+innerHTML
 ).to
@@ -1755,33 +1755,15 @@
 ble.
-virtualElement.properties
+element
 .cla
@@ -2009,33 +2009,15 @@
 ble.
-virtualElement.properties
+element
 .cla

Fix table tests