Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tree-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class TreeManager {
}

filterTree(searchTerm, keepTreeOnSearch, keepChildrenOnSearch) {
const matches = this.getMatches(searchTerm.toLowerCase())
const matches = this.getMatches(searchTerm)

const matchTree = new Map()

Expand Down Expand Up @@ -289,7 +289,7 @@ class TreeManager {
}

_getAddOnMatch(matches, searchTerm) {
let isMatch = (node, term) => node.label.toLowerCase().indexOf(term) >= 0
let isMatch = (node, term) => node.label.toLowerCase().indexOf(term.toLowerCase()) >= 0
if (typeof this.searchPredicate === 'function') {
isMatch = this.searchPredicate
}
Expand Down
3 changes: 2 additions & 1 deletion src/tree-manager/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ test('should get matching nodes when using custom search predicate', t => {
},
],
}
const searchPredicate = (node, term) => node.customField && node.customField.toLowerCase().indexOf(term) >= 0
const searchPredicate = (node, term) =>
node.customField && node.customField.toLowerCase().indexOf(term.toLowerCase()) >= 0
const manager = new TreeManager({ data: tree, searchPredicate })
const { allNodesHidden, tree: matchTree } = manager.filterTree('tEaPoT')
t.false(allNodesHidden)
Expand Down