Skip to content

Commit

Permalink
fix(search): do not show root elements in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Jun 5, 2024
1 parent 9bf8d23 commit 4704746
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/features/search-pad/SearchPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ SearchPad.prototype._search = function(pattern) {

var searchResults = this._searchProvider.find(pattern);

searchResults = searchResults.filter(function(searchResult) {
return !self._canvas.getRootElements().includes(searchResult.element);
});

if (!searchResults.length) {
return;
}
Expand Down
11 changes: 11 additions & 0 deletions test/spec/features/search-pad/SearchPadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,17 @@ describe('features/searchPad', function() {
});


it('should not display root elements', inject(function(canvas) {

// when
typeText(input_node, 'root');

// then
var result_nodes = domQueryAll(SearchPad.RESULT_SELECTOR, canvas.getContainer());
expect(result_nodes).length(0);
}));


it('should display results', inject(function(canvas) {

// given
Expand Down

0 comments on commit 4704746

Please sign in to comment.