forked from ShelterTechSF/askdarcel-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parameterizes the clear search button
- Loading branch information
1 parent
0d6d094
commit 55d8554
Showing
9 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/components/search/SearchResults/SearchResults.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from "react"; | ||
import { InstantSearch } from "react-instantsearch-core"; | ||
import { render, screen, waitFor } from "@testing-library/react"; | ||
import SearchResults from "components/search/SearchResults/SearchResults"; | ||
import { createSearchClient } from "../../../../test/helpers/createSearchClient"; | ||
import ClearSearchButton from "components/search/Refinements/ClearSearchButton"; | ||
|
||
describe("SearchResults", () => { | ||
test("renders a Clear Search button if passed as a param", async () => { | ||
const searchClient = createSearchClient(); | ||
|
||
render( | ||
<InstantSearch | ||
searchClient={searchClient} | ||
indexName="fake_test_search_index" | ||
initialUiState={{ | ||
fake_test_search_index: { | ||
query: "fake query", | ||
}, | ||
}} | ||
> | ||
<SearchResults | ||
mobileMapIsCollapsed={false} | ||
clearSearchButton={<ClearSearchButton />} | ||
/> | ||
</InstantSearch> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByTestId("clear-search-button")).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Webpack is not available in tests to handle the css import parsing and handling. Our test config tells jest to | ||
// replace any style imports it sees with this empty object. | ||
export default ""; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
|
||
const ReactMarkdown = ({ | ||
children, | ||
}: { | ||
children: string | JSX.Element | JSX.Element[] | (() => JSX.Element); | ||
}) => { | ||
return <>{children}</>; | ||
}; | ||
|
||
export default ReactMarkdown; |