Skip to content

Commit

Permalink
fixed bug with modifying hidden things
Browse files Browse the repository at this point in the history
  • Loading branch information
zackify committed Sep 24, 2015
1 parent eba464c commit 42dad57
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Optionally, use `modifyAll` to change every item.
~~~js

modifyId({hidden, value, key, row}){
//row is the current row object
return <a href={value}>{value}</a>
}

Expand All @@ -70,10 +69,11 @@ modifyAll={this.modify}
###hide

```js
let modify = ({hidden}) => {
expect(hidden.id).to.be.equal(1)
let modify = ({hidden, value}) => {
expect(hidden.id).to.be.equal(1)
return value
}
Test(<Table rows={[{id: 1, name: 'zach'}]} hide={['id']}/>)
Test(<Table rows={[{id: 1, name: 'zach'}]} hide={['id']} modifyAll={modify}/>)
.find('td')
.element(td => {
expect(td.props.children).to.be.equal('zach');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-legit-table",
"version": "0.4.0",
"version": "0.4.1",
"description": "the simplest table component out there",
"main": "lib/table.js",
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions tests/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ describe('Table component', () => {
})

it('should hide id row', () => {
let modify = ({hidden}) => {
expect(hidden.id).to.be.equal(1)
let modify = ({hidden, value}) => {
expect(hidden.id).to.be.equal(1)
return value
}
Test(<Table rows={[{id: 1, name: 'zach'}]} hide={['id']}/>)
Test(<Table rows={[{id: 1, name: 'zach'}]} hide={['id']} modifyAll={modify}/>)
.find('td')
.element(td => {
expect(td.props.children).to.be.equal('zach');
Expand Down

0 comments on commit 42dad57

Please sign in to comment.