diff --git a/src/MUIDataTable.js b/src/MUIDataTable.js index 675a89898..0204a62c2 100644 --- a/src/MUIDataTable.js +++ b/src/MUIDataTable.js @@ -12,8 +12,7 @@ import debounce from "lodash.debounce"; import { getStyle, DataStyles } from "./DataStyles"; const defaultTableStyles = { - main: { - } + main: {}, }; class MUIDataTable extends React.Component { @@ -338,11 +337,7 @@ class MUIDataTable extends React.Component { styles={getStyle(this.options, "table.main")}> {tableStyles => ( (this.tableRef = el)} className={tableStyles.main}> - + )} - + ); } diff --git a/src/MUIDataTableSearch.js b/src/MUIDataTableSearch.js index 3d0f8790b..5abb775ba 100644 --- a/src/MUIDataTableSearch.js +++ b/src/MUIDataTableSearch.js @@ -52,10 +52,7 @@ class MUIDataTableSearch extends React.Component { const { classes, onHide, onSearch, options } = this.props; return ( - + {headStyles => (
(this.rootRef = el)}> diff --git a/src/MUIDataTableToolbar.js b/src/MUIDataTableToolbar.js index 07769b035..12fd0bad6 100644 --- a/src/MUIDataTableToolbar.js +++ b/src/MUIDataTableToolbar.js @@ -164,7 +164,6 @@ const defaultFilterStyles = { }, }; - class MUIDataTableToolbar extends React.Component { state = { iconActive: null, diff --git a/test/MUIDataTable.test.js b/test/MUIDataTable.test.js index 185e367d2..76efb4f45 100644 --- a/test/MUIDataTable.test.js +++ b/test/MUIDataTable.test.js @@ -21,12 +21,13 @@ describe("", function() { it("should render a table", () => { const shallowWrapper = shallow(); - assert.strictEqual(shallowWrapper.dive().name(), "MUIDataTable"); + assert.strictEqual(shallowWrapper.dive().name(), "Paper"); }); + it("should correctly build internal columns data structure", () => { const shallowWrapper = shallow(); - const actualResult = shallowWrapper.dive().dive().state().columns; + const actualResult = shallowWrapper.state().columns; const expectedResult = [ { display: true, name: "First Name", sort: "desc" }, { display: true, name: "Company", sort: "desc" }, @@ -37,17 +38,17 @@ describe("", function() { assert.deepEqual(actualResult, expectedResult); }); + it("should correctly build internal table data and displayData structure", () => { const shallowWrapper = shallow(); - const state = shallowWrapper.dive().dive().state(); + const state = shallowWrapper.state(); assert.deepEqual(state.data, data); assert.deepEqual(state.displayData, data); }); - it("should correctly build internal filterList structure", () => { const shallowWrapper = shallow(); - const state = shallowWrapper.dive().dive().state(); + const state = shallowWrapper.state(); const expectedResult = [[],[],[],[]]; assert.deepEqual(state.filterList, expectedResult); @@ -56,7 +57,7 @@ describe("", function() { it("should correctly build internal unique column data for filterData structure", () => { const shallowWrapper = shallow(); - const state = shallowWrapper.dive().dive().state(); + const state = shallowWrapper.state(); const expectedResult = [ ["Joe James", "John Walsh", "Bob Herm", "James Houston"], ["Test Corp"], @@ -75,7 +76,7 @@ describe("", function() { }; const shallowWrapper = shallow(); - const state = shallowWrapper.dive().dive().state(); + const state = shallowWrapper.state(); assert.strictEqual(state.rowsPerPage, 20); }); @@ -88,7 +89,7 @@ describe("", function() { }; const shallowWrapper = shallow(); - const state = shallowWrapper.dive().dive().state(); + const state = shallowWrapper.state(); assert.deepEqual(state.rowsPerPageOptions, [5, 10, 15]); }); @@ -122,7 +123,7 @@ describe("", function() { it("should properly set internal filterList when calling filterUpdate method", () => { const shallowWrapper = shallow(); - const table = shallowWrapper.dive().dive(); + const table = shallowWrapper; const instance = table.instance(); instance.filterUpdate(0, "Joe James", "checkbox"); table.update(); @@ -136,7 +137,7 @@ describe("", function() { // set a filter const shallowWrapper = shallow(); - const table = shallowWrapper.dive().dive(); + const table = shallowWrapper; const instance = table.instance(); instance.filterUpdate(0, "Joe James", "checkbox"); table.update(); @@ -155,7 +156,7 @@ describe("", function() { it("should properly set searchText when calling searchTextUpdate method", () => { const shallowWrapper = shallow(); - const table = shallowWrapper.dive().dive(); + const table = shallowWrapper; const instance = table.instance(); instance.searchTextUpdate("Joe James"); @@ -165,6 +166,5 @@ describe("", function() { assert.deepEqual(state.displayData, [["Joe James", "Test Corp", "Yonkers", "NY"]]); }); - - + });