Skip to content

Commit

Permalink
fix(search-pad): do not search on whitespace only input
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Nov 21, 2024
1 parent e80568c commit 5a2fd31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/features/search-pad/SearchPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ SearchPad.prototype._search = function(pattern) {
this._clearResults();

// do not search on empty query
if (!pattern || pattern === '') {
if (!pattern.trim()) {
return;
}

Expand Down
13 changes: 13 additions & 0 deletions test/spec/features/search-pad/SearchPadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,19 @@ describe('features/search-pad', function() {
}));


it('should ignore whitespace only', inject(function(canvas) {

// given
var find = sinon.spy(searchProvider, 'find');

// when
typeText(input_node, ' ');

// then
expect(find).callCount(0);
}));


it('should search per key stroke', inject(function(canvas) {

// given
Expand Down

0 comments on commit 5a2fd31

Please sign in to comment.