diff --git a/lib/features/search-pad/SearchPad.js b/lib/features/search-pad/SearchPad.js index 94d235c71..4979d03bf 100644 --- a/lib/features/search-pad/SearchPad.js +++ b/lib/features/search-pad/SearchPad.js @@ -181,7 +181,7 @@ SearchPad.prototype._search = function(pattern) { this._clearResults(); // do not search on empty query - if (!pattern || pattern === '') { + if (!pattern.trim()) { return; } diff --git a/test/spec/features/search-pad/SearchPadSpec.js b/test/spec/features/search-pad/SearchPadSpec.js index 9abc5e0f8..015bad3fb 100644 --- a/test/spec/features/search-pad/SearchPadSpec.js +++ b/test/spec/features/search-pad/SearchPadSpec.js @@ -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