bootstrap-table-react
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "bootstrap-table-react", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Simple bootstrap table in react", | ||
@@ -11,4 +11,4 @@ "main": "lib/table.js", | ||
"prepublish": "npm run build", | ||
"test": "NODE_PATH=src NODE_ENV=test mocha --compilers js:babel-register --compilers jsx:babel-register --recursive", | ||
"coverage": "NODE_PATH=src NODE_ENV=test babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive", | ||
"test": "NODE_ENV=test mocha --compilers js:babel-register --compilers jsx:babel-register --recursive", | ||
"coverage": "NODE_ENV=test babel-node $(npm bin)/isparta cover $(npm bin)/_mocha -- --recursive", | ||
"codecov": "codecov" | ||
@@ -25,16 +25,17 @@ }, | ||
"devDependencies": { | ||
"babel-cli": "~6.5.0", | ||
"babel-eslint": "5.0.0-beta6", | ||
"babel-plugin-rewire": "1.0.0-beta-5", | ||
"babel-polyfill": "~6.5.0", | ||
"babel-preset-es2015": "~6.5.0", | ||
"babel-preset-react": "~6.5.0", | ||
"babel-preset-stage-0": "~6.5.0", | ||
"babel-cli": "6.6.5", | ||
"babel-core": "6.6.5", | ||
"babel-eslint": "5.0.0", | ||
"babel-plugin-rewire": "^1.0.0-rc-1", | ||
"babel-polyfill": "6.6.1", | ||
"babel-preset-es2015": "6.6.0", | ||
"babel-preset-react": "6.5.0", | ||
"babel-preset-stage-0": "6.5.0", | ||
"chai": "^3.5.0", | ||
"codecov": "^1.0.1", | ||
"eslint": "^1.10.3", | ||
"eslint-plugin-babel": "^3.0.0", | ||
"eslint-plugin-react": "^3.13.0", | ||
"eslint": "2.2.0", | ||
"eslint-plugin-babel": "^3.1.0", | ||
"eslint-plugin-react": "^4.2.0", | ||
"isparta": "^4.0.0", | ||
"jsdom": "^8.0.2", | ||
"jsdom": "^8.1.0", | ||
"mocha": "^2.4.5", | ||
@@ -46,8 +47,8 @@ "mock-localstorage": "^0.1.3", | ||
"sinon-chai": "^2.8.0", | ||
"teaspoon": "^6.1.1" | ||
"teaspoon": "^6.1.2" | ||
}, | ||
"dependencies": { | ||
"change-case": "^2.3.1", | ||
"classnames": "^2.2.1", | ||
"ramda": "^0.19.0" | ||
"classnames": "^2.2.3", | ||
"ramda": "^0.19.1" | ||
}, | ||
@@ -54,0 +55,0 @@ "peerDependencies": { |
@@ -8,3 +8,3 @@ import React from "react"; | ||
import Body from "body"; | ||
import Body from "../src/body"; | ||
@@ -11,0 +11,0 @@ chai.use(sinonChai); |
@@ -5,3 +5,3 @@ import React from "react"; | ||
import Head from "head"; | ||
import Head from "../src/head"; | ||
@@ -8,0 +8,0 @@ describe("`Head` component", () => { |
@@ -7,3 +7,3 @@ import React from "react"; | ||
import Row from "row"; | ||
import Row from "../src/row"; | ||
@@ -10,0 +10,0 @@ chai.use(sinonChai); |
import React from "react"; | ||
import {identity} from "ramda"; | ||
import chai, {expect} from "chai"; | ||
import {expect} from "chai"; | ||
import $ from "teaspoon"; | ||
import sinon from "sinon"; | ||
import sinonChai from "sinon-chai"; | ||
import Table from "table"; | ||
import Table from "../src/table"; | ||
chai.use(sinonChai); | ||
describe("`Table` component", () => { | ||
const normalizeColumns = sinon.stub().returns([]); | ||
beforeEach(() => { | ||
Table.__Rewire__("normalizeColumns", normalizeColumns); | ||
}); | ||
afterEach(() => { | ||
Table.__ResetDependency__("normalizeColumns"); | ||
normalizeColumns.reset(); | ||
}); | ||
it("renders a table", () => { | ||
@@ -66,9 +51,2 @@ const $Table = $(<Table collection={[]} columns={[]} />).render(); | ||
it("call the `normalizeColumns` function with props `columns`", () => { | ||
const columns = ["item1", "item2"]; | ||
$(<Table collection={[]} columns={columns} />).render(); | ||
expect(normalizeColumns).to.have.callCount(1); | ||
expect(normalizeColumns).to.have.been.calledWith(columns); | ||
}); | ||
it("call the component `Head`", () => { | ||
@@ -75,0 +53,0 @@ const $Table = $(<Table collection={[]} columns={[]} />).render(); |
@@ -1,131 +0,21 @@ | ||
import chai, {expect} from "chai"; | ||
import sinon from "sinon"; | ||
import sinonChai from "sinon-chai"; | ||
import {expect} from "chai"; | ||
import * as utils from "utils"; | ||
import {normalizeColumns} from "../src/utils"; | ||
chai.use(sinonChai); | ||
describe("utils", () => { | ||
describe("`utils`", () => { | ||
describe("normalizeColumns", () => { | ||
describe("`stringify` function", () => { | ||
const stringify = utils.__get__("stringify"); | ||
it("if the argument is a string, returns the argument", () => { | ||
const ret = stringify("string"); | ||
expect(ret).to.equal("string"); | ||
it("normalises columns", () => { | ||
const columns = normalizeColumns(["column1", {key: "column2"}]); | ||
expect(columns[0]).to.have.property("key", "column1"); | ||
expect(columns[0]).to.have.property("formattedKey", "Column 1"); | ||
expect(columns[0].valueFormatter).to.be.a("function"); | ||
expect(columns[1]).to.have.property("key", "column2"); | ||
expect(columns[1]).to.have.property("formattedKey", "Column 2"); | ||
expect(columns[0].valueFormatter).to.be.a("function"); | ||
}); | ||
it("if the argument is a not a string, returns the argument stringified", () => { | ||
const ret = stringify({a: "b"}); | ||
expect(ret).to.deep.equal(`{"a": "b"}`); | ||
}); | ||
}); | ||
describe("`fromString` function", () => { | ||
const fromString = utils.__get__("fromString"); | ||
const stringifySpy = sinon.spy(); | ||
before(() => { | ||
utils.__Rewire__("stringify", stringifySpy); | ||
}); | ||
after(() => { | ||
utils.__ResetDependency__("stringify"); | ||
}); | ||
it("return the correct object from a string", () => { | ||
const ret = fromString("column name"); | ||
expect(ret).to.deep.equal({ | ||
key: "column name", | ||
formattedKey: "Column Name", | ||
valueFormatter: stringifySpy | ||
}); | ||
}); | ||
}); | ||
describe("`fromObject` function", () => { | ||
const fromObject = utils.__get__("fromObject"); | ||
const stringifySpy = sinon.spy(); | ||
before(() => { | ||
utils.__Rewire__("stringify", stringifySpy); | ||
}); | ||
after(() => { | ||
utils.__ResetDependency__("stringify"); | ||
}); | ||
it("return the correct object from an object [CASE: key: `key`]", () => { | ||
const ret = fromObject({key: "column 1"}); | ||
expect(ret).to.deep.equal({ | ||
key: "column 1", | ||
formattedKey: "Column 1", | ||
valueFormatter: stringifySpy | ||
}); | ||
}); | ||
it("return the correct object from an object [CASE: keys: `key` and `formattedKey`]", () => { | ||
const ret = fromObject({ | ||
key: "column 1", | ||
formattedKey: "First Column" | ||
}); | ||
expect(ret).to.deep.equal({ | ||
key: "column 1", | ||
formattedKey: "First Column", | ||
valueFormatter: stringifySpy | ||
}); | ||
}); | ||
it("return the correct object from an object [CASE: keys: `key`, `formattedKey` and `valueFormatter`]", () => { | ||
const valueFormatterSpy = sinon.spy(); | ||
const ret = fromObject({ | ||
key: "column 1", | ||
formattedKey: "First Column", | ||
valueFormatter: valueFormatterSpy | ||
}); | ||
expect(ret).to.deep.equal({ | ||
key: "column 1", | ||
formattedKey: "First Column", | ||
valueFormatter: valueFormatterSpy | ||
}); | ||
}); | ||
}); | ||
describe("`normalizeColumns` function", () => { | ||
const fromString = sinon.spy(); | ||
const fromObject = sinon.spy(); | ||
beforeEach(() => { | ||
utils.__Rewire__("fromString", fromString); | ||
utils.__Rewire__("fromObject", fromObject); | ||
}); | ||
afterEach(() => { | ||
fromString.reset(); | ||
fromObject.reset(); | ||
utils.__ResetDependency__("fromString"); | ||
utils.__ResetDependency__("fromObject"); | ||
}); | ||
it("return an array of object", () => { | ||
const ret = utils.normalizeColumns(["column1"]); | ||
expect(ret).to.be.an("array"); | ||
}); | ||
it("call `fromString` if the argument of the array is a string and `fromObject` if it is an object", () => { | ||
utils.normalizeColumns(["column1", {key: "column2"}, "column3", "column4"]); | ||
expect(fromString).to.have.been.callCount(3); | ||
expect(fromObject).to.have.been.callCount(1); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
36291
22
694
Updatedclassnames@^2.2.3
Updatedramda@^0.19.1