Skip to content

Commit

Permalink
Merge pull request #35 from pat310/fix-toggle-function
Browse files Browse the repository at this point in the history
fix toggle function
  • Loading branch information
pat310 committed Mar 12, 2017
2 parents 5df4500 + e9fc59c commit ef6d542
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Pivot {
}

toggle(rowNum) {
if (rowNum in this.collapsedRows) {
if (this.data.table[rowNum].row in this.collapsedRows) {
return this.expand(rowNum);
}
return this.collapse(rowNum);
Expand Down
5 changes: 4 additions & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ describe('pivot', () => {

const startState = pivot.data.table;

pivot.toggle(1).toggle(1);
pivot.toggle(1);
pivot.toggle(2);
pivot.toggle(2);
pivot.toggle(1);

expect(startState).to.deep.equal(pivot.data.table);
});
Expand Down

0 comments on commit ef6d542

Please sign in to comment.