Commit cf8a9d0
committed
search: avoid reacting to an empty search term
When someone currently presses the `/` key to let the search box get the
focus, and then immediately presses the Enter key without typing a
search term, the site currently redirects to
https://git-scm.com/undefined.
The same happens when the search term consists of only one character.
That's because it is somewhat unexpected that anybody would want to see
_all_ search results before seeing _some_ search results.
Let's fix that.
Incidentally, this also helps with adding a test that verifies that
hitting Enter in the search box will never direct the browser to that
`/undefined` URL, no matter how quickly that search term and the Enter
key are provided: The `runSearch()` function triggers on key-up, which
Playwright's `fill()` method (which can be used to fill in a search
term) does not emit.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 00dc084 commit cf8a9d0
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
374 | 380 | | |
375 | 381 | | |
376 | 382 | | |
| |||
0 commit comments