forked from AllenFang/react-bootstrap-table
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
jest.dontMock('../src/BootstrapTable.js'); | ||
jest.dontMock('../src/TableHeaderColumn.js'); | ||
jest.dontMock('../src/TableBody.js'); | ||
jest.dontMock('../src/TableColumn.js'); | ||
jest.dontMock('../src/TableHeader.js'); | ||
jest.dontMock('../src/TableRow.js'); | ||
jest.dontMock('../src/pagination/PaginationList.js'); | ||
jest.dontMock('../src/pagination/PageButton.js'); | ||
|
||
describe('BootstrapTable', function() { | ||
var testData = [ | ||
{id: 1, name: "name1", price: 100}, | ||
{id: 2, name: "name2", price: 120}, | ||
{id: 3, name: "name3", price: 130}, | ||
{id: 4, name: "name4", price: 140}, | ||
{id: 5, name: "name5", price: 110} | ||
]; | ||
|
||
it('init', function() { | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
jest.dontMock('../src/BootstrapTable.js'); | ||
jest.dontMock('../src/TableHeaderColumn.js'); | ||
jest.dontMock('../src/TableBody.js'); | ||
jest.dontMock('../src/TableColumn.js'); | ||
jest.dontMock('../src/TableHeader.js'); | ||
jest.dontMock('../src/TableRow.js'); | ||
jest.dontMock('../src/pagination/PaginationList.js'); | ||
jest.dontMock('../src/pagination/PageButton.js'); | ||
|
||
describe('TableHeaderColumn Test', function() { | ||
|
||
var React; | ||
var TestUtils; | ||
var ReactTestUtils; | ||
var TableHeaderColumn; | ||
|
||
beforeEach(function(){ | ||
React = require('react/addons'); | ||
TableHeaderColumn = require('../src/TableHeaderColumn.js'); | ||
TestUtils = React.addons.TestUtils; | ||
ReactTestUtils = React.addons.ReactTestUtils; | ||
}); | ||
|
||
it('A basic table header column test', function() { | ||
|
||
var idHeaderColumn = TestUtils.renderIntoDocument( | ||
<TableHeaderColumn dataField="id">Product ID</TableHeaderColumn> | ||
); | ||
|
||
expect(idHeaderColumn.props.dataField).toEqual("id"); | ||
expect(idHeaderColumn.props.children).toEqual("Product ID"); | ||
expect(idHeaderColumn.props.dataAlign).toEqual("left"); | ||
expect(idHeaderColumn.props.dataSort).toEqual(false); | ||
expect(idHeaderColumn.props.dataFormat).toBe(undefined); | ||
|
||
|
||
var reactThElm = TestUtils.findRenderedDOMComponentWithTag(idHeaderColumn, 'th'); | ||
expect(reactThElm).not.toBe(null); | ||
var th = reactThElm.getDOMNode(); | ||
expect(th.className).toEqual(""); | ||
expect(th.childNodes.length).toEqual(1); | ||
|
||
var reactDivElm = TestUtils.findRenderedDOMComponentWithTag(idHeaderColumn, 'div'); | ||
expect(reactDivElm).not.toBe(null); | ||
var div = reactDivElm.getDOMNode(); | ||
expect(div.className).toEqual("th-inner table-header-column"); | ||
expect(div.textContent).toEqual("Product ID"); | ||
|
||
// ReactTestUtils.Simulate.click(reactDivElm); | ||
// expect(th.getDOMNode()).toEqual(0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
// var ReactTools = require('react-tools'); | ||
var babel = require("babel"); | ||
module.exports = { | ||
process: function(src) { | ||
return babel.transform(src, { blacklist: ["react"] }).code; | ||
process: function(src, filename) { | ||
if (!babel.canCompile(filename)) { | ||
return ''; | ||
} | ||
// Ignore all files within node_modules | ||
if (filename.indexOf('node_modules') === -1) { | ||
return babel.transform(src, {filename: filename}).code;; | ||
} | ||
return src; | ||
} | ||
}; |