Skip to content

Commit

Permalink
Make it possible to reset search columns. Fix #450
Browse files Browse the repository at this point in the history
  • Loading branch information
javve committed Oct 15, 2016
1 parent 1c91d2d commit 37edc1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
[See commit →](https://github.com/javve/list.js/commit/42d3db491801677c63238d5db3e0e9257087999a)
- **[Bugfix]** Make mkdir in build script OS agnostic
[See commit →](https://github.com/javve/list.js/commit/ba387125efddd7f5f4f8360bce516ae740cb5ae5)
- **[Bugfix]** Make it possible to reset search columns
[See commit →](https://github.com/javve/list.js/commit/293b185e7b6277fba98bfd0a7b3bc7da04c708e7)
- **[Misc]** Use local Browserify
[See commit →](https://github.com/javve/list.js/commit/83f6502dcea428fa2de2513d19ac71f82905ecb8)

Expand Down
3 changes: 3 additions & 0 deletions src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ module.exports = function(list) {
if (args.length == 2 && args[1] instanceof Array) {
columns = args[1];
} else if (args.length == 2 && typeof(args[1]) == "function") {
columns = undefined;
customSearch = args[1];
} else if (args.length == 3) {
columns = args[1];
customSearch = args[2];
} else {
columns = undefined;
}
},
setColumns: function() {
Expand Down
6 changes: 6 additions & 0 deletions test/test.search.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ describe('Search', function() {
var result = list.search('jonny', [ 'pet' ]);
expect(result.length).to.equal(0);
});
it('should remove columnm option', function() {
var result = list.search('jonny', [ 'born' ]);
expect(result.length).to.equal(0);
var result = list.search('jonny');
expect(result.length).to.equal(1);
});
});

describe('Custom search function', function() {
Expand Down

0 comments on commit 37edc1b

Please sign in to comment.