Skip to content
Snippets Groups Projects
Unverified Commit 4415a111 authored by Ariya Hidayat's avatar Ariya Hidayat Committed by GitHub
Browse files

Search: do not complain on empty string (#16251)

parent f76d8333
No related branches found
No related tags found
No related merge requests found
......@@ -138,21 +138,21 @@ export default class SearchBar extends React.Component {
if (e.key === "Enter" && (searchText || "").trim().length > 0) {
this.props.onChangeLocation({
pathname: "search",
query: { q: searchText },
query: { q: searchText.trim() },
});
}
}}
/>
{active && MetabaseSettings.searchTypeaheadEnabled() && (
<div className="absolute left right text-dark" style={{ top: 60 }}>
{searchText.length > 0 ? (
{searchText.trim().length > 0 ? (
<Card
className="overflow-y-auto"
style={{ maxHeight: 400 }}
py={1}
>
<Search.ListLoader
query={{ q: searchText }}
query={{ q: searchText.trim() }}
wrapped
reload
debounced
......
......@@ -13,6 +13,14 @@ describe("scenarios > search", () => {
cy.signInAsAdmin();
});
it("should not search on an empty string", () => {
cy.intercept("/api/search", req => {
expect("Unexpected call to /api/search").to.be.false;
});
cy.visit("/");
cy.findByPlaceholderText("Search…").type(" ");
});
it("should allow users to paginate results", () => {
generateQuestions(TOTAL_ITEMS);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment